具有一些文本值的Edittext,如果我们在editiext文本上多次单击,应用程序崩溃。这只发生在s3中。
<EditText
android:id="@+id/screen_name"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignTop="@id/screen_name_label"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/screen_name_label"
android:clickable="false"
android:paddingBottom="0dp"
android:paddingTop="0dp"
android:singleLine="true"
android:textSize="12dp" >
</EditText>
logcat的
09-03 11:50:07.190: E/AndroidRuntime(15963): FATAL EXCEPTION: main
09-03 11:50:07.190: E/AndroidRuntime(15963): java.lang.IllegalStateException: ActionBarContextView can only be used with android:layout_width="match_parent" (or fill_parent)
09-03 11:50:07.190: E/AndroidRuntime(15963): at com.android.internal.widget.ActionBarContextView.onMeasure(ActionBarContextView.java:493)
09-03 11:50:07.190: E/AndroidRuntime(15963): at android.view.View.measure(View.java:15473)
09-03 11:50:07.190: E/AndroidRuntime(15963): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5054)
09-03 11:50:07.190: E/AndroidRuntime(15963): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1396)
09-03 11:50:07.190: E/AndroidRuntime(15963): at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
09-03 11:50:07.190: E/AndroidRuntime(15963): at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
09-03 11:50:07.190: E/AndroidRuntime(15963): at android.view.View.measure(View.java:15473)
09-03 11:50:07.190: E/AndroidRuntime(15963): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5054)
09-03 11:50:07.190: E/AndroidRuntime(15963): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
答案 0 :(得分:1)
我知道这有点晚了,但万一其他人有问题。
我认为它发生的真正原因是你隐藏了标题栏。当您多次单击文本时,它会打开一个 ActionBar ,由于您隐藏了标题,因此无法通知。
看看这个: Enable/Disable ActionBar Menu Item
答案 1 :(得分:0)
android:layout_width="fill_parent"
fill_parant,因此代替fill_parant
使用match_parant
..