You can use the attribute style="@style/your_style"
that is defined for any widget.
To define your style you have to create a file called style.xml
in the values folder (i.e.
esvaluesstyles.xml
) and use the following syntax:
<style name="You.EditText.Style" parent="@android:style/Widget.EditText">
<item name="android:textColor">@color/your_color</item>
<item name="android:gravity">center</item>
</style>
The attribute parent="@android:style/Widget.EditText"
is important because it will ensure that the style being defined extends the basic Android EditText
style, thus only properties different from the default style need to be defined.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…