我知道在的xml中設置android:textIsSelectable="true"
會顯示原生文本選擇彈出窗口,並且我一直在我的應用程序中使用它。它不工作任何更多的時候我嘗試設置在連接到RecyclerView
每當我儘量選擇出現以下日誌文本視圖中的相同屬性 -「android:textIsSelectable =」true「對於RecyclerView中的TextView不起作用
TextView: TextView does not support text selection. Action mode cancelled.
而且我不知道爲什麼?爲什麼它在其他屏幕上工作,而不是與RecyclerView
。我看了多個職位 -
TextView with android:textIsSelectable="true" not working in listview
textview textIsSelectable="true" not working in Listview
android:textIsSelectable="true" for TextView inside Listview does not work
但後來我遇到了這個帖子 -
Android: "TextView does not support text selection. Action mode cancelled"
而且通過@hungkk
回覆爲我工作。他的解決方案建議TextView
寬度從match_parent
更改爲wrap_content
。
我知道我可以做到這一點,但我的問題是如何解決這個問題,因爲它看起來很奇怪。此外,如果我想將寬度保持爲match_parent
,解決方案是什麼。
歡迎任何輸入。
什麼是你該選擇做什麼? (Marty或Shadab)。對於'match_parent'或'wrap_content',使用'View.OnClickListener()'我沒有任何問題。 – Gary99
Wierd但我讀過幾篇文章,當回收者的視圖重用單元格時,如果TextView設置爲match_parent,則禁用可選文本功能。您是否已嘗試將android:inputType =「textMultiLine」而不是'android:textIsSelectable =「true」'設置爲解決方法? – fmaccaroni