文字选中显示图标android textSelectHandleRight

这几天要做文本选中处理,用到了textSelectHandleRight属性

这几个属性的效果textSelectHandleRight textSelectHandleLeft textSelectHandle简单点说可以看系统文本选中时出现的复制箭头,左边,右边的,就是用的这个效果

 

查看android源码可以发现定义方式在styles.xml里

<style name="Widget.TextView">
        <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
        <item name="android:textSelectHandleLeft">?android:attr/textSelectHandleLeft</item>
        <item name="android:textSelectHandleRight">?android:attr/textSelectHandleRight</item>
        <item name="android:textSelectHandle">?android:attr/textSelectHandle</item>
        <item name="android:textEditPasteWindowLayout">?android:attr/textEditPasteWindowLayout</item>
        <item name="android:textEditNoPasteWindowLayout">?android:attr/textEditNoPasteWindowLayout</item>
        <item name="android:textEditSidePasteWindowLayout">?android:attr/textEditSidePasteWindowLayout</item>
        <item name="android:textEditSideNoPasteWindowLayout">?android:attr/textEditSideNoPasteWindowLayout</item>
        <item name="android:textEditSuggestionItemLayout">?android:attr/textEditSuggestionItemLayout</item>
        <item name="android:textCursorDrawable">?android:attr/textCursorDrawable</item>
    </style>
在attr.xml里
<!-- Reference to a drawable that will be used to display a text selection
             anchor on the left side of a selection region. -->
        <attr name="textSelectHandleLeft" />
        <!-- Reference to a drawable that will be used to display a text selection
             anchor on the right side of a selection region. -->
        <attr name="textSelectHandleRight" />
        <!-- Reference to a drawable that will be used to display a text selection
             anchor for positioning the cursor within text. -->
        <attr name="textSelectHandle" />
在theme.xml text部分
<!-- Text selection handle attributes -->
        <item name="textSelectHandleLeft">@android :drawable/text_select_handle_left</item>
        <item name="textSelectHandleRight">@android :drawable/text_select_handle_right</item>
        <item name="textSelectHandle">@android :drawable/text_select_handle_middle</item>
        <item name="textSelectHandleWindowStyle">@android :style/Widget.Holo.TextSelectHandle</item>
        <item name="textSuggestionsWindowStyle">@android :style/Widget.Holo.TextSuggestionsPopupWindow</item>
        <item name="textCursorDrawable">@android :drawable/text_cursor_holo_dark</item>

转载于:https://my.oschina.net/u/199733/blog/73952

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值