“android:textIsSelectable=”true" not working for TextView in RecyclerView

前端 未结 7 1031
甜味超标
甜味超标 2021-01-01 09:31

I know that setting android:textIsSelectable=\"true\" in xml for the TextView will show the native text selection popup and I\'ve been using that i

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-01 10:10

    override fun onBindViewHolder(viewHolder: ViewHolder, position: Int) {
        yourTextView.fixTextSelection()
    }
    
    fun TextView.fixTextSelection() {
        setTextIsSelectable(false)
        post { setTextIsSelectable(true) }
    }
    

提交回复
热议问题