Illegal State exception on double clicking a edittext

后端 未结 4 1040
长发绾君心
长发绾君心 2021-01-20 22:12

Hi I am getting an illegal state exception on double clicking a EditText .Here is the stack trace.pls help

06-30 11:18:24.970: ERROR/AndroidRuntime(3011): ja         


        
相关标签:
4条回答
  • 2021-01-20 22:24

    In results of next example are:

    • disable context menu (double click etc.),
    • and prevent crash on dialog on input's event.

    
    editText.setCustomSelectionActionModeCallback(new EditTextNoContextHelper());

    public class EditTextNoContextHelper implements ActionMode.Callback { public boolean onCreateActionMode(ActionMode mode, Menu menu) { return false; } public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } public boolean onActionItemClicked(ActionMode mode, MenuItem item) { return false; } public void onDestroyActionMode(ActionMode mode) { } }

    0 讨论(0)
  • 2021-01-20 22:28

    Try checking the solution provided here:

    http://code.google.com/p/android/issues/detail?id=19021

    EDIT:

    The solution suggests the following:

    Change:

    <style name="MyDialogTheme">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowFrame">@null</item>
        <item name="android:backgroundDimEnabled">false</item>
    </style>
    

    To this:

    <style name="MyDialogTheme" parent="@android:style/Theme.Dialog">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowFrame">@null</item>
        <item name="android:backgroundDimEnabled">false</item>
    

    0 讨论(0)
  • 2021-01-20 22:31

    I think the problem comes from the layout you implemented.

    I guess you gave a size for your actionBarContextView and this is not possible. You have to choose fill_parent or match_parent for this item.

    0 讨论(0)
  • 2021-01-20 22:36

    If you read the first line it says ActionBarContextView can only be used with android:layout_width="match_parent" (or fill_parent). In other words, something in your layout has a invalid android:layout_width. Check that...

    0 讨论(0)
提交回复
热议问题