如何在EditText上隐藏气泡光标

如何在EditText上隐藏气泡光标

本文介绍了如何在EditText上隐藏气泡光标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有EditText,则单击它会显示一个气泡光标.我在下面显示一张图片(以Twitter应用为例)...

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

我的问题是:

  1. 这实际上叫什么(我认为绝对不是Bubble Cursor)?
  2. 如何从我们的EditText中禁用它? (或来自我们的整个Activity/Fragment/App)
  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)

推荐答案

它称为文本选择句柄.

有一种棘手的隐藏方式:用style.xml中的0px透明可绘制对象替换.

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

drawable/zero_px_transparent.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>

并修改您的style.xml:

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>

这篇关于如何在EditText上隐藏气泡光标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 08:19