android - Custom AlertDialog ScrollView, too big in 2.3 missing ok button -


i have show info, instructions of how use program, i've chosen alertdialog using custom xml scrollview. tested in tablet, xperia neo , 2 virtual devices. in 3 of them goes good, in 2.3 small screen,the dialog big , has bug in visualization makes hard close. idea why? here code: xml scrollview:

<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" >     <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:orientation="vertical"      android:textsize="10sp">     </textview> </scrollview>` 

and code calling it:

alertdialog.builder builder = new alertdialog.builder(this);     builder.setmessage(r.string.msg_help)            .setcancelable(false)            .setview(layoutinflater.from(this).inflate(r.layout.dialog_scrollable,null))            .settitle(r.string.help_title)            .setpositivebutton("ok", new dialoginterface.onclicklistener() {                public void onclick(dialoginterface dialog, int id) {                     //do things                }            });     alertdialog alert = builder.create();     alert.getwindow().setlayout(layoutparams.wrap_content, layoutparams.wrap_content);     alert.show(); 

here how looks: http://postimg.org/image/wvg61x0qv/

an alertdialog makes content scrollable automatically if wouldn't fit on screen. instead of inflating custom xml layout, set text dialog builder.settext()builder.setmessage().

alertdialog.builder builder = new alertdialog.builder(this); builder.setmessage(r.string.msg_help)        .setcancelable(false)        .settitle(r.string.help_title)        .setmessage(r.string.help)        .setpositivebutton("ok", new dialoginterface.onclicklistener() {            public void onclick(dialoginterface dialog, int id) {                 //do things            }        }); alertdialog alert = builder.create(); alert.show(); 

notice removed line alert.getwindow().setlayout() because think it's useless.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -