AutocompleteTextView + android:inputType =" textMultiLines" - >紧急

时间:2014-10-13 16:32:44

标签: android autocompletetextview android-inputtype

我希望我的ACTV能够在多行上显示文字,因为下拉项目是很长的字符串。

SingleLine = false不起作用,但我读的正确方法是 textMultiLine 。我试了一下它就崩溃了。谁知道这个?

我可以为什么有多行可能导致出界异常(通常在尚未显示的情况下尝试到达第2行)但真正的理解是超越我。

 <AutoCompleteTextView
        android:id="@+id/actvSearchStuff"
        style="@style/MyEditText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="15dp"
        android:hint="@string/start_search_stuff"
        android:inputType="textMultiLine"
        android:drawableLeft="@android:drawable/ic_menu_search" 
        android:imeOptions="actionDone"/>

如果没有这个,我有一个完美的自动完成功能,有或没有自定义布局来显示下拉列表。

崩溃日志(开头):

    10-13 18:24:41.641: E/InputEventReceiver(21110): Exception dispatching input event.
    10-13 18:24:41.641: E/MessageQueue-JNI(21110): Exception in MessageQueue callback: handleReceiveCallback
    10-13 18:24:41.651: E/MessageQueue-JNI(21110): java.lang.StringIndexOutOfBoundsException: length=0; index=1
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at java.lang.String.indexAndLength(String.java:584)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at java.lang.String.charAt(String.java:578)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.text.Layout.getOffsetAtStartOf(Layout.java:1280)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.text.Layout.getOffsetForHorizontal(Layout.java:1101)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.widget.TextView.getOffsetAtCoordinate(TextView.java:10562)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.widget.TextView.getOffsetForPosition(TextView.java:10538)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.widget.Editor$SelectionModifierCursorController.onTouchEvent(Editor.java:5548)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.widget.Editor.onTouchEvent(Editor.java:1264)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.widget.TextView.onTouchEvent(TextView.java:9217)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.view.View.dispatchTouchEvent(View.java:8132)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2423)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2113)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2423)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2113)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2423)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2113)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2423)
    10-13 18:24:41.651: E/MessageQueue-JNI(21110):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2113)

另一部分:

10-13 18:24:41.671: E/AndroidRuntime(21110): Process: com.ier.tepv.base, PID: 21110
10-13 18:24:41.671: E/AndroidRuntime(21110): java.lang.StringIndexOutOfBoundsException: length=0; index=1
10-13 18:24:41.671: E/AndroidRuntime(21110):    at java.lang.String.indexAndLength(String.java:584)
10-13 18:24:41.671: E/AndroidRuntime(21110):    at java.lang.String.charAt(String.java:578)
10-13 18:24:41.671: E/AndroidRuntime(21110):    at android.text.Layout.getOffsetAtStartOf(Layout.java:1280)
10-13 18:24:41.671: E/AndroidRuntime(21110):    at android.text.Layout.getOffsetForHorizontal(Layout.java:1101)
10-13 18:24:41.671: E/AndroidRuntime(21110):    at android.widget.TextView.getOffsetAtCoordinate(TextView.java:10562)
10-13 18:24:41.671: E/AndroidRuntime(21110):    at android.widget.TextView.getOffsetForPosition(TextView.java:10538)
10-13 18:24:41.671: E/AndroidRuntime(21110):    at android.widget.Editor$SelectionModifierCursorController.onTouchEvent(Editor.java:5548)
10-13 18:24:41.671: E/AndroidRuntime(21110):    at android.widget.Editor.onTouchEvent(Editor.java:1264)

0 个答案:

没有答案