Android默认文本选择器复制文本不起作用
Posted
技术标签:
【中文标题】Android默认文本选择器复制文本不起作用【英文标题】:Android Default textselector to copy text not working 【发布时间】:2015-04-25 17:25:50 【问题描述】:java.lang.IndexOutOfBoundsException: setSpan (-1 ... -1) starts before 0
at android.text.SpannableStringInternal.checkRange(SpannableStringInternal.java:355)
at android.text.SpannableStringInternal.setSpan(SpannableStringInternal.java:77)
at android.text.SpannableString.setSpan(SpannableString.java:46)
at android.text.Selection.setSelection(Selection.java:76)
at android.widget.Editor$SelectionEndHandleView.updateSelection(Editor.java:3485)
at android.widget.Editor$HandleView.positionAtCursorOffset(Editor.java:3173)
at android.widget.Editor$HandleView.positionAtCursorOffset(Editor.java:3157)
at android.widget.Editor$SelectionEndHandleView.updatePosition(Editor.java:3500)
at android.widget.Editor$HandleView.onTouchEvent(Editor.java:3266)
at android.view.View.dispatchTouchEvent(View.java:7736)
at android.view.View.dispatchPointerEvent(View.java:7916)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4023)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3902)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3452)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3502)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3471)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3578)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3479)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3635)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3452)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3502)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3471)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3479)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3452)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5657)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5588)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5559)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5737)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:5710)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:5756)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:542)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
&PRODUCT=ghost_retasia&DISPLAY=0.currentSizeRange.smallest=[720,670]
当我在 android 中单击文本视图以复制选定的文本时出现此错误。两个选择器句柄指向相同的位置,当我尝试移动它们时,我正在关闭这个力。 有时也是我的
textisselectable=true
此功能在少数设备上不起作用?我谷歌但我还没有找到任何相关的工作解决方案。 我有自定义列表视图,我想复制自定义行的内容。
【问题讨论】:
【参考方案1】:这是由于 html.fromttext 或链接。见https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=137509
【讨论】:
以上是关于Android默认文本选择器复制文本不起作用的主要内容,如果未能解决你的问题,请参考以下文章
为啥 jQuery UI 日期选择器在 jQuery 对话框模式中不起作用?