3 回答
TA贡献1799条经验 获得超9个赞
我认为最简单的解决方案可能是使用样式。
只需将其放入您的styles.xml文档中
<!-- changes the default colours for EditTexts, including non-text elements (also works with the DatePicker -->
<style name="appCompatStyle" parent="Theme.AppCompat.Light">
<item name="colorControlNormal">@color/lightPrimaryText</item>
<item name="colorControlActivated">@color/colorAccent</item>
<item name="android:editTextStyle">@style/editTextStyle</item>
</style>
<!-- changes the default text colour for the EditTexts -->
<style name="editTextStyle" parent="android:style/Widget.EditText">
<item name="android:textColor">@color/lightPrimaryText</item>
</style>
并将这些属性放入布局XML
android:theme="@style/appCompatStyle"
并根据自己的喜好对其进行自定义。
添加回答
举报