我想更改编辑文本下方的蓝色,我不知道它是什么属性。
我尝试使用其他背景色,但没有用。
我在下面附上了一张图片:

我想更改编辑文本下方的蓝色,我不知道它是什么属性。
我尝试使用其他背景色,但没有用。
我在下面附上了一张图片:

Answers:
以编程方式(仅一行代码)设置EditText的下划线颜色实际上相当容易。
设置颜色:
editText.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_IN);
去除颜色:
editText.getBackground().clearColorFilter();
注意:当EditText处于焦点上时,您设置的颜色不会生效,而是具有焦点颜色。
API参考:
Control.Background.SetColorFilter(Android.Graphics.Color.White, PorterDuff.Mode.SrcIn);
                    Renderer您覆盖哪个?我试图弄清楚如何使它适合搜索栏。
                    SearchBarRenderer是的类型不是EditText。无法正常工作。
                    使用android:backgroundTint=""你的EditTextXML布局。
对于api <21,您可以AppCompatEditText从支持库中使用app:backgroundTint=""
android:background="@null"适用于api <21的设备
                    您必须为EditText(焦点,启用,激活)的每种状态使用不同的背景图像,而不是彩色图像。
http://android-holo-colors.com/
在上面的站点中,您可以从Holo主题的许多组件中获取图像。只需选择“ EditText”和所需的颜色即可。您可以在页面底部看到预览。
下载.zip文件,然后将资源复制粘贴到您的项目中(图像和XML)。
如果您的XML命名为:apptheme_edit_text_holo_light.xml(或类似名称):
转到您的XML“ styles.xml”并添加自定义EditText样式:
<style name="EditTextCustomHolo" parent="android:Widget.EditText">
   <item name="android:background">@drawable/apptheme_edit_text_holo_light</item>
   <item name="android:textColor">#ffffff</item>
</style>
只需在您的EditText:
<EditText
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   style="@style/EditTextCustomHolo"/>
就是这样,希望对您有所帮助。
这适用于新旧版本的Android(即使在API 10上也可以正常使用!)。
在您的中定义此样式styles.xml:
<style name="EditText.Login" parent="Widget.AppCompat.EditText">
    <item name="android:textColor">@android:color/white</item>
    <item name="android:textColorHint">@android:color/darker_gray</item>
    <item name="colorAccent">@color/blue</item>
    <item name="colorControlNormal">@color/blue</item>
    <item name="colorControlActivated">@color/blue</item>
</style>
现在,在您的XML中,将其设置为主题和样式(将style设置为set textColor,将theme设置为所有其他内容):
<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:inputType="text"
    style="@style/EditText.Login"
    android:theme="@style/EditText.Login"/>
此解决方案在带下划线的较新的Android版本(从Lollipop或Marshmallow开始)上引起微小的UI故障。
此线程中讨论了此问题。(我还没有亲自尝试过此解决方案)
您可以更改styles.xml中指定的EditText 下划线的颜色。在您的应用程序主题styles.xml中添加以下内容。
<item name="android:textColorSecondary">@color/primary_text_color</item> 
正如安娜在评论部分指出的
  <item name="android:colorControlActivated">@color/black</item>
将此主题设置为主题样式非常适合更改edittext下划线的颜色。
android:textColorSecondary也用于确定DrawerLayoutActionBar中后退箭头和汉堡包图标的颜色。
                    <item name="colorControlNormal">@color/edittext_underline_color</item>由于导航栏的颜色问题,我最终使用而不是textColorSecondary。
                    因此,您需要在可绘制文件夹中创建一个新的.xml文件。
在该文件中粘贴以下代码:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
   <item
    android:bottom="8dp"
    android:left="-3dp"
    android:right="-3dp"
    android:top="-3dp">
    <shape android:shape="rectangle">
     <stroke
       android:width="1dp"
       android:color="@color/white"/>
     </shape>
   </item>
</layer-list>
然后在您的EditText中,设置
android:background="@drawable/your_drawable"
您可以使用可绘制的xml,设置边角,填充等。
在您的应用样式中,定义属性colorAccent。在这里找到一个例子
<style name="AppTheme" parent="Theme.AppCompat.Light">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/action_bar</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/action_bar</item>
</style>
              您可以使用此行代码轻松地以编程方式更改EditText的颜色:
edittext.setBackgroundTintList(ColorStateList.valueOf(yourcolor));
使用下面的代码更改编辑文本边框的背景颜色。
在drawable下创建新的XML文件。
abc.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#00000000" />
    <stroke android:width="1dip" android:color="#ffffff" />
</shape>
并将其添加为您的编辑文本的背景
android:background="@drawable/abc"
              要更改底线颜色,可以在应用程序主题中使用此颜色:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="colorControlNormal">#c5c5c5</item>
    <item name="colorControlActivated">#ffe100</item>
    <item name="colorControlHighlight">#ffe100</item>
</style>
要更改浮动标签的颜色,请写以下主题:
<style name="TextAppearence.App.TextInputLayout" parent="@android:style/TextAppearance">
<item name="android:textColor">#4ffd04[![enter image description here][1]][1]</item>
</style>
并在您的布局中使用此主题:
 <android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="20dp"
    app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">
    <EditText
        android:id="@+id/edtTxtFirstName_CompleteProfileOneActivity"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:capitalize="characters"
        android:hint="User Name"
        android:imeOptions="actionNext"
        android:inputType="text"
        android:singleLine="true"
        android:textColor="@android:color/white" />
</android.support.design.widget.TextInputLayout>
              您可以使用AppCompatEditText和颜色选择器来做到这一点:
            <androidx.appcompat.widget.AppCompatEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:backgroundTint="@color/selector_edittext_underline" />
selector_edittext_underline.xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="@color/focused_color" 
          android:state_focused="true" />
    <item android:color="@color/hint_color" />
</selector>
              如果您不必支持API <21的设备,请在xml中使用backgroundHint,例如:
 <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPersonName"
            android:hint="Task Name"
            android:ems="10"
            android:id="@+id/task_name"
            android:layout_marginBottom="15dp"
            android:textAlignment="center"
            android:textColor="@android:color/white"
            android:textColorLink="@color/blue"
            android:textColorHint="@color/blue"
            android:backgroundTint="@color/lighter_blue" />
为了获得更好的支持和后备,请使用@Akariuz解决方案。backgroundHint是最轻松的解决方案,但不向后兼容,可根据您的要求进行调用。
只需将xml代码中的android:backgroundTint更改为您的颜色