0
点赞
收藏
分享

微信扫一扫

EditText和AutoCompleteTextView设置文字选中颜色


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

所用API解释

android:textColorHighlight Color of the text selection highlight.

EditText设置效果

EditText和AutoCompleteTextView设置文字选中颜色_android

AutoCompleteTextView 设置效果

EditText和AutoCompleteTextView设置文字选中颜色_xml_02

实现代码



<?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>

推荐

  • 更优秀的APP:31个APP用户界面设计经典案例
  • Android创意实例详解



举报

相关推荐

0 条评论