Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 更改自定义AutoCompleteTextView的下划线颜色_Android_Xamarin_Xamarin.android_Autocompletetextview - Fatal编程技术网

Android 更改自定义AutoCompleteTextView的下划线颜色

Android 更改自定义AutoCompleteTextView的下划线颜色,android,xamarin,xamarin.android,autocompletetextview,Android,Xamarin,Xamarin.android,Autocompletetextview,我想将自定义自动完成文本视图的下划线颜色更改为其他颜色,如下面电话号码下的蓝色,并在下划线上方保留约2dp的空间(请注意,垂直线的两端是一条) 我在网上找不到解决这个问题的办法 在创建自定义AutoCompleteTextView之前,我通过accent on colors.xml更改了内置AutoCompleteTextView的下划线颜色,如下所示 <resources> ... <color name="accent">#206DDA</

我想将自定义
自动完成文本视图的下划线颜色更改为其他颜色,如下面电话号码下的蓝色,并在下划线上方保留约2dp的空间(请注意,垂直线的两端是一条)

我在网上找不到解决这个问题的办法

在创建自定义AutoCompleteTextView之前,我通过accent on colors.xml更改了内置
AutoCompleteTextView
的下划线颜色,如下所示

<resources>
        ...
  <color name="accent">#206DDA</color>
...
</resources>
activity.xml如下:

<style name="Autocomplete" parent="Widget.AppCompat.Light.AutoCompleteTextView">    
    <item name="colorControlActivated">@color/primary</item>
  </style>
<android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <MyAutoCompleteTextView             
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Phone number"
                android:completionThreshold="1"
                android:maxLines="1"
                android:inputType="text"
                android:imeOptions="actionNext"
                android:theme="@style/Autocomplete"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp" />
        </android.support.design.widget.TextInputLayout>

使用
android:backgroundTint
更改
MyAutoCompleteTextView
的颜色。像

<MyAutoCompleteTextView             
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    .......
    android:backgroundTint="#FF0000" />


要使其更具可定制性,请将
MyAutoCompleteTextView
的父类更改为
AppCompatAutoCompleteTextView
而不是
AutoCompleteTextView

将主题设置为
TextInputLayout
。。删除2dp空间是什么意思??
<MyAutoCompleteTextView             
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    .......
    android:backgroundTint="#FF0000" />