我做材料设计风格的应用
我想更改AutoCompleteTextView样式
像android.support.v7.internal.widget.TintEditText中的样式
我在style.xml中添加了样式:
<style name="AppTheme" parent="AppTheme.Base"/> <style name="AppTheme.Base" parent="Theme.AppCompat"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewAppTheme</item> </style> <style name="AutoCompleteTextViewAppTheme" parent="Base.Widget.AppCompat.EditText"/>
这有效,但线条颜色不会改变.
具有材质设计的EditTexts似乎使用colorControlActivated和colorControlnormal.因此,我试图在先前的样式定义中覆盖这些属性,但它没有任何效果.
我需要做什么才能让它发挥作用?
解决方法
尝试以这种方式在xml中添加用于小部件的所需样式:
<View style="@style/NameOfYourTheme" ... />
如果这不起作用,你可以尝试自己设计.
您必须更改可以查找的TextView属性here.
可以通过更改应添加到样式中的android:textColor属性来更改实例的Textcolor,例如:
<style name="AutoCompleteTextViewAppTheme" parent="Base.Widget.AppCompat.EditText"/> <item name="android:textColor">#ffffffff</item> </style>
如果要更改edittext行,则必须更改背景属性,例如以这种方式:
<item name ="android:background="@drawable/line_background"> </item>
并在drawables文件夹中添加一个具有类似内容的新文件line_background.xml:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <stroke android:color="#c0c000" android:width="3dp"></stroke> </shape>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。