相关疑难解决方法(0)

如何在editText字段上更改突出显示颜色

下面是我在Android应用程序中的自定义编辑文本字段的屏幕截图.当您键入给定单词时,您当前键入的单词的文本以灰色突出显示,并将文本显示为黑色,直到您点击空格键,此时文本将按预期变为白色.有没有办法更改突出显示的颜色和突出显示的文本?

在此输入图像描述

我的编辑文本xml看起来像这样

 <EditText
                    android:id="@+id/searchField"
                    android:layout_width="160dp"
                    android:layout_height="44dp"
                    android:layout_alignParentLeft="true"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="60dp"
                    android:background="@null"
                    android:cursorVisible="true"
                    android:ems="10"
                    android:textColor="@color/white"
                    android:textColorHighlight ="#ff0000"
                    android:textCursorDrawable="@null" >
                </EditText>
Run Code Online (Sandbox Code Playgroud)

整个布局

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!--
         As the main content view, the view below consumes the entire
         space available using match_parent in both dimensions.
    -->

    <RelativeLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#fff" >



        <fragment
            android:id="@+id/map"
            android:name="com.sapientnitro.inhouse.drop.components.DRPCustomMapFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />



        <ImageButton
            android:id="@+id/btn_center_local"
            android:layout_width="44dp"
            android:layout_height="44dp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_marginBottom="50dp"
            android:layout_marginRight="15dp"
            android:background="@drawable/btn_center_on_local_up" />

        <RelativeLayout
            android:id="@+id/top_bar"
            android:layout_width="match_parent"
            android:layout_height="70dp"
            android:background="#ddffffff" >

            <ImageButton
                android:id="@+id/btn_menu"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="10dp" …
Run Code Online (Sandbox Code Playgroud)

java android android-layout android-edittext

20
推荐指数
4
解决办法
3万
查看次数

如何更改EditText句柄的颜色?

绿色来自哪里?我已经尝试更改accentColor属性,该属性适用于应用程序的其他部分,但不在此处.

editText颜色 来自Lollipop的应用程序的屏幕截图.

我怎样才能改变颜色:

  • 文字处理drawables?怎么给他们着色?
  • 选择全背景颜色?

也许是未来的一些提示......你是怎么发现的?我一直在遇到所有这些令人困惑的颜色/造型问题.是否有某种列表告诉我,我需要为某个组件覆盖哪个默认颜色或属性?

android android-edittext android-styles

8
推荐指数
1
解决办法
5230
查看次数