当前位置: 移动技术网 > IT编程>移动开发>Android > Android中EditText和AutoCompleteTextView设置文字选中颜色方法

Android中EditText和AutoCompleteTextView设置文字选中颜色方法

2019年07月24日  | 移动技术网IT编程  | 我要评论

万宁哥哥,问问图标怎么点亮,丫头站住别跑

edittext和autocompletetextview设置文字选中颜色 大多数android rom上,文本选择的背景色都是很好看的鲜绿色, 但是在某些垃圾的三星手机上,居然是蓝色,令人恶心反感,其实完全可以通过程序来修改,文本的默认选中背景色.

所用api解释

复制代码 代码如下:

android:textcolorhighlight color of the text selection highlight.

edittext设置效果

autocompletetextview 设置效果

实现代码

复制代码 代码如下:

<?xml version="1.0" encoding="utf-8"?>
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <edittext
      android:id="@+id/et_inputbox"
      android:layout_height="wrap_content"
      android:layout_width="match_parent"
      android:textcolorhighlight="#b4df87"
        />

    <autocompletetextview
        android:id="@+id/act_input"
        android:layout_below="@id/et_inputbox"
        android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:textcolorhighlight="#b4df87"
        />
</linearlayout>

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网