我想为我的所有单词设置可点击,而不是特殊单词。我的应用程序是一种电子书,我想为它们设置方法 onclick
,例如翻译。
最佳答案
阅读官方文档: https://developer.android.com/reference/android/text/style/ClickableSpan
SpannableString string = new SpannableString("Text with clickable text");
string.setSpan(new CustomClickableSpan(), 10, 19,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
“可点击”文本可点击
关于java - 我们如何为 TextView 中的所有单词设置可点击?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56713291/