Re: [android-developers] How to set height of a custom developed AlertDialog ?
Justin, Felipe, none of those also worked.
Finally I created a new xml layout for 2 items or for more items and set height in the XML with more than 2 items and it got working as I want. As AlertDialog always starts from center screen, so using getWindow().setAttributes(), I set the "y" & "Gravity.TOP | CENTER_HORIZONTAL" for the window, so it starts from top of the screen & remains in the center.
Also managed out the same for different density screens.
Thanks a lot to all of you for supporting me alot & finally I could achieve it applying some ideas. With this I want to close this post, as I got the answer. Is their any ways to mark it closed and/or answered.
Thanks.
On Thu, Sep 6, 2012 at 7:34 PM, Felipe Caldas <caldas@gmail.com> wrote:
Is your inflated layout a LinearLayout ? If not, try with LinearLayout.
Another possibility isdialog = new Dialog(this,android.R.style.Theme_Translucent_NoTitleBar);dialog.setContentView(R.layout.custom_dialog);LayoutParams lp=dialog.getWindow().getAttributes();lp.x=100;lp.y=100;lp.width=100;lp.height=200;lp.gravity=Gravity.TOP | Gravity.LEFT;lp.dimAmount=0;lp.flags=LayoutParams.FLAG_LAYOUT_NO_LIMITS | LayoutParams.FLAG_NOT_TOUCH_MODAL;// dialog.getWindow().setAttributes(lp);dialog.show();--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home