得到的EditText跨区文本 [英] Get spanned text in EditText
问题描述
我想知道是否有适用于EditText上所选文本的任何样式。例如:
I want to know if there is any style applied to a selected text in EditText. For example
这是大胆
这是要我要实现的,如果选择的是大胆然后取出大胆别的应用粗体
Here is want I want to achieve, If selected is bold then remove bold else apply bold
推荐答案
您应该能够使用上的EditText视图中的 getEditableText()
方法来获取一个可编辑 - 其中有一个方法 getFilters()
。你应该能够循环通过过滤器,以查看是否所选择的区域由其中的一个所覆盖。
you should be able to use the getEditableText()
method on the EditText view to get an Editable - which has a method getFilters()
. you should be able to loop through the filters to see if the selected area is covered by one of them.
http://developer.android.com/reference/android/widget/ EditText.html
http://developer.android.com/reference/android/text/ Editable.html
这篇关于得到的EditText跨区文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!