Android dialog box width gets really small when I set a background image for an activity? -
in android project, added background image activity xml file. set style not show title bar on top. activity has button when pressed show dialog box.
recently added image , made not show title bar, when went test out, , clicked button, dialog box width 100px. before added background image, dialog box width fine, fills parent.
this xml file used dialog box:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="@dimen/activity_vertical_margin" android:orientation="vertical" > <textview android:id="@+id/textview_email" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@+string/email" /> <edittext android:id="@+id/textinput_email" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:inputtype="textemailaddress" android:text="james.jn1981@gmail.com" /> <textview android:id="@+id/textview_password" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@+string/password" /> <edittext android:id="@+id/textinput_password" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:inputtype="textpassword" android:text="123" /> </linearlayout> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <button android:id="@+id/button_exit" style="@style/footer" android:background="@drawable/bg_footer" android:text="@+string/cancel" /> <button android:id="@+id/button_login" style="@style/footer" android:background="@drawable/bg_footer" android:text="@+string/ok" /> </linearlayout> </linearlayout>
does know whats wrong here?
edit:
its that's causing issue:
android:theme="@android:style/theme.notitlebar"
how can remove title bar , still make dialog width normal width?
thanks
try this:
//use android.r.style.theme or theme_light dialog dialog = new dialog(context, android.r.style.theme_light); dialog.requestwindowfeature(window.feature_no_title); //whatever layout file dialog.setcontentview(r.layout.mycustomdialoglayout); dialog.show();
Comments
Post a Comment