【问题标题】:Selection not working for spanned text (Background span) in Android EditText选择不适用于 Android EditText 中的跨区文本(背景跨度)
【发布时间】:2016-10-07 07:04:03
【问题描述】:

我正在尝试通过双击选择一个具有背景跨度的单词,但该单词没有被选中。

但如果我以编程方式使用setSelection(start,end) 选择工作。双击和长按无法选择

我在编辑文本中使用了 LinkMovementMethod。

谢谢

【问题讨论】:

  • 请查看我的回答

标签: android android-edittext android-styles


【解决方案1】:

您是否尝试过使用属性textIsSelectable

<TextView
    android:id="@+id/deviceIdTV"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textIsSelectable="true"
    android:text="" />

来自https://stackoverflow.com/a/8969000/619673

但是我曾经使用LinkMovementMethod 使文本可点击,即 url 或滚动 textView。

【讨论】:

    猜你喜欢
    • 2021-09-03
    • 1970-01-01
    • 1970-01-01
    • 2013-08-07
    • 2018-01-04
    • 2019-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多