0
votes

I have below App theme. It supports below item tags like colorPrimary, colorPrimaryDark, colorAccent. I want to know what other item tag it supports. For example: if i want to set the color of edit text that should be consistent through out the app then what item tag should i use?

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
1
Just make a new style For eg. Edit_text_Style and add the desired attributes in this style according to your look for the edit_text box .Extend this style to be parent="@android:style/Widget.EditText.Now refer to this style in your AppTheme style using <item name="android:my_ed">@style/Edit_text_Style</item>Samarth Kejriwal

1 Answers

2
votes

To set the color of an edit text you can do like this:

<style name="MyTheme" parent="android:Theme">
    <item name="android:editTextStyle">@style/CustomEditTextStyle</item>
    ...
</style>

<style name="CustomEditTextStyle" parent="android:Widget.EditText">
    <item name="android:textColor">#000000</item>
    <item name="android:textStyle">bold</item>
    <item name="android:textSize">8sp</item>
</style>

And if you really want to know what other item can be supported if you are using Android Studio press (Ctrl + Space) in the name property like this:

enter image description here

Then you can have a overview of other tag it support, hope it help.