0

Edittext with some text value,if we click multiple times on the text of editiext,app crashes.This happens only in 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)
Sunil Kumar
  • 7,086
  • 4
  • 32
  • 50
user1897321
  • 21
  • 1
  • 1
  • 7

2 Answers2

1

I know it's kind of late, but in case other people have problems with that.

I think the real reason why it happens is that you've hidden Title Bar. When you click text multiple times, it will open up an ActionBar , which it can't inflate since you've hidden the title.

Take a look at this: Enable/Disable ActionBar Menu Item

Here is how action bar looks on android

Community
  • 1
  • 1
0

android:layout_width="fill_parent" fill_parant is deprecated in new version of API so in place of fill_parant use match_parant..

Piyush
  • 18,895
  • 5
  • 32
  • 63
Sunil Kumar
  • 7,086
  • 4
  • 32
  • 50