广

android开发

  • IOS开发
  • android开发
  • PHP编程
  • JavaScript
  • ASP.NET
  • ASP编程
  • JSP编程
  • Java编程
  • 易语言
  • Ruby编程
  • Perl编程
  • AJAX
  • 正则表达式
  • C语言
  • 编程开发

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

    2018-04-25 21:47:14 次阅读 稿源:互联网
    广告

    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>

    一起学吧部分文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与一起学吧进行文章共享合作。

    广告
    广告
    广告