exception - android.view.InflateException - Error inflating class android.widget.EditText -
hello i'm trying show custom alertdialog on screen. i'm inflating layout dialog, layout includes 2 textviews, 1 ratingbar , 1 edittext.
when try popup dialog i'm getting exception :
e/androidruntime(12989): android.view.inflateexception: binary xml file line #25: error inflating class android.widget.edittext
important point error occurs on android 2.3.x devices, works great on android 4.x
dialog_comment.xml
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativelayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ratingbar android:id="@+id/dialogcommentratingbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/textview1" android:stepsize="1" /> <textview android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/dialogcommentratingbar" android:text="yorumunuz" android:textappearance="?android:attr/textappearancelarge" /> <edittext android:id="@+id/dialogcommentcomment" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignparentleft="true" android:layout_below="@+id/textview2" android:background="?android:attr/edittextbackground" android:ems="10" android:gravity="top" android:inputtype="textmultiline" > </edittext> <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:text="oyunuz" android:textappearance="?android:attr/textappearancelarge" /> </relativelayout>
commentdialog.java
@override public dialog oncreatedialog(bundle savedinstancestate) { layoutinflater inflater=getactivity().getlayoutinflater(); final view view=inflater.inflate(r.layout.dialog_comment, null); final ratingbar rating=(ratingbar)view.findviewbyid(r.id.dialogcommentratingbar); final edittext comment=(edittext)view.findviewbyid(r.id.dialogcommentcomment); alertdialog.builder builder=new alertdialog.builder(getactivity()); builder.setview(view); builder.settitle("enter comment!"); return builder.create(); }
how show alertdialog
fragmentmanager fm = getsupportfragmentmanager(); commentdialog commentdialog = new commentdialog(); commentdialog.show(fm, "fragment_comment_dialog");
replace
android:textappearance="?android:attr/textappearancelarge"
with
android:textappearance="@android:style/textappearance.large"
Comments
Post a Comment