How do I hide of Bubble cursor on EditText?

坚强是说给别人听的谎言 提交于 2019-12-04 22:38:52

问题


If you have an EditText, clicking it will show a Bubble Cursor. I show a picture below (using Twitter app as example)...

My question is:

  1. What is this called actually (I think it's not Bubble Cursor definitely)?
  2. How to disabled it from our EditText? (or from our entire Activity/Fragment/App)


回答1:


It's called text select handle.

There is a tricky way to hide it: replace with an 0px transparent drawable in your style.xml.

drawable/zero_px_transparent.xml

 <?xml version="1.0" encoding="UTF-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
     <size android:height="0dp" android:width="0dp"/>
 </shape>

And modify your style.xml:

<style name="CustomTheme" parent="@android:style/Theme.Holo.Light">
     <item name="android:textSelectHandleLeft">@drawable/zero_px_transparent</item>
     <item name="android:textSelectHandleRight">@drawable/zero_px_transparent</item>
     <item name="android:textSelectHandle">@drawable/zero_px_transparent</item>
</style>


来源:https://stackoverflow.com/questions/38966605/how-do-i-hide-of-bubble-cursor-on-edittext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!