提示值的长度大于17个字符的EditText会导致“呈现期间引发异常:16”

时间:2019-02-08 15:26:06

标签: android indexoutofboundsexception

晚上好。我正在Android Studio上的一个项目上工作,由于我已更新至3.3.1版(我不记得我的上一个版本),所以遇到了一个问题,即字符串长度超过17个字符可作为EditText和将其可见性从“可见”更改为“消失”会导致设计视图预览消失,并出现“渲染期间引发异常:16”错误。更新之前没有发生这种情况。它不会影响已编译的程序,但是对开发来说却很烦人。

我正在使用API​​ 19。

以下是错误的详细信息:

java.lang.ArrayIndexOutOfBoundsException: 16
    at android.text.StaticLayout.generate(StaticLayout.java:854)
    at android.text.StaticLayout.<init>(StaticLayout.java:603)
    at android.text.StaticLayout.<init>(StaticLayout.java:50)
    at android.text.StaticLayout$Builder.build(StaticLayout.java:425)
    at android.widget.TextView.makeNewLayout(TextView.java:8272)
    at android.widget.TextView.assumeLayout(TextView.java:8104)
    at android.widget.TextView.onPreDraw(TextView.java:6742)
    at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:977)
    at android.view.AttachInfo_Accessor.dispatchOnPreDraw(AttachInfo_Accessor.java:46)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.renderAndBuildResult(RenderSessionImpl.java:402)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.renderAndBuildResult(RenderSessionImpl.java:555)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:424)
    at com.android.layoutlib.bridge.BridgeRenderSession.render(BridgeRenderSession.java:120)
    at com.android.ide.common.rendering.api.RenderSession.render(RenderSession.java:151)
    at com.android.ide.common.rendering.api.RenderSession.render(RenderSession.java:133)
    at com.android.tools.idea.rendering.RenderTask.lambda$renderInner$6(RenderTask.java:719)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

非常感谢

0 个答案:

没有答案