I'm trying to change the style of the EditText? Is it possible to achieve that? If so I'll appreciate being told about it, otherwise what alternative ways are available.
See Question&Answers more detail:osI'm trying to change the style of the EditText? Is it possible to achieve that? If so I'll appreciate being told about it, otherwise what alternative ways are available.
See Question&Answers more detail:osYou 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.