i want to see the dialog in Top of layout. How to move it?
All,
1.) I have a Dialog showing on my application. Right now it is showing in the center of the device. But i want to see that dialog in Top of layout. How to move it?
2.) How to add an image in a Dialog box?
EDIT: I added an image in background of Button. I want to move this button into right corner of Pop up Dialog. How to do that? And also i want to know how to move the entire Pop up Dialog itself into Top of the Layout screen? As i'm new to this development, please some one suggest me how do i achieve this?
EDIT: CAN SOME ONE TELL ME HOW TO MAKE THREE CONTROLS IN A SINGLE LINE USING LAYOUT? I WANT TO SHOW AN IMABE, A BUTTON AND TEXT L开发者_如何学CABEL IN A SINGLE LINE. I TRIED THAT ON LAYOUT IN ECLIPSE. BUT IT ACCEPTS ONLY ONE CONTROL FOR ONE LINE, IF ADD NEXT CONTROL IT GOES TO NEXT LINE(ROW). I WANT TO MAKE THREE CONTROLS TO BE IN SINGLE LINE. HOW DO I ACHIEVE THIS?
After creating the dialog you can call dialog.getWindow().setGravity(Gravity.TOP)
If u want to change height and width
dialog.getWindow().getAttributes()
.... This will return WindowManager.LayoutParams
you can set ur values and use setAttributes()
function
I am not aware of an API to change the position of a dialog. You may be better served creating an activity and using android:theme="@android:style/Theme.Dialog"
to make it look like a dialog.
If you go that route, you will then be able to use all of the standard techniques for placing widgets (e.g., images) wherever you like.
精彩评论