У меня очень странное поведение с моим TextView
. Я не могу найти причину, так как большинство других проблем с этой трассировкой стека связано с EditText
.
Это в моем макете:
<TextView
android:id="@+id/transaction_card_scan_message_view"
android:layout_width="0dp"
android:layout_height="150dp"
android:elevation="2dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:lines="5"
android:textColor="@color/transaction_text"
android:textSize="@dimen/transaction_card_scan_title_textSize"
android:textAlignment="center"
android:textAllCaps="true"/>
Я получаю эту ошибку:
2019-10-21 17:47:32.177 18455-18455/com.iaxept.contactless E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.iaxept.contactless, PID: 18455
java.lang.IndexOutOfBoundsException
at android.graphics.Paint.getRunAdvance(Paint.java:2986)
at android.text.TextLine.handleText(TextLine.java:719)
at android.text.TextLine.handleRun(TextLine.java:873)
at android.text.TextLine.measureRun(TextLine.java:387)
at android.text.TextLine.measure(TextLine.java:277)
at android.text.TextLine.metrics(TextLine.java:251)
at android.text.Layout.getLineExtent(Layout.java:1094)
at android.text.Layout.drawText(Layout.java:383)
at android.widget.Editor.drawHardwareAccelerated(Editor.java:1903)
at android.widget.Editor.onDraw(Editor.java:1822)
at android.widget.TextView.onDraw(TextView.java:6691)
at android.view.View.draw(View.java:18319)
at android.view.View.updateDisplayListIfDirty(View.java:17297)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3950)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3930)
at android.view.View.updateDisplayListIfDirty(View.java:17260)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3950)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3930)
at android.view.View.updateDisplayListIfDirty(View.java:17260)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3950)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3930)
at android.view.View.updateDisplayListIfDirty(View.java:17260)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3950)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3930)
at android.view.View.updateDisplayListIfDirty(View.java:17260)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3950)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3930)
at android.view.View.updateDisplayListIfDirty(View.java:17260)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3950)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3930)
at android.view.View.updateDisplayListIfDirty(View.java:17260)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3950)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3930)
at android.view.View.updateDisplayListIfDirty(View.java:17260)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3950)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3930)
at android.view.View.updateDisplayListIfDirty(View.java:17260)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:666)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:672)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:780)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:3112)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2908)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2502)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1509)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7051)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
at android.view.Choreographer.doCallbacks(Choreographer.java:702)
at android.view.Choreographer.doFrame(Choreographer.java:638)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Я пытался messageView.setTransformationMethod(new AllCapsTransformationMethod(getParentActivity()))
безрезультатно. Это действительно странно, так как работает без проблем, когда текст представляет собой смесь строчных и прописных букв, а трассировка стека не совсем полезна.