android - Set a consistent style to all EditText (for e.g.) -
i'm trying make edittext's in application have consistent look. i'm aware can this:
<style name="app_edittextstyle"> <item name="android:background">@drawable/filled_roundededges_box_dark</item> <item name="android:textcolor">#808080</item> <item name="android:layout_height">45dip</item> </style> then can make particular edittext have style doing this:
<edittext ... style="@style/app_edittextstyle ...> but way have remember set style individually each , every edittext in application tedious, if not error prone.
is there way make part of theme or something? don't have associate style every edittext. fictitious code block:
<style name="app_theme" parent="@android:style/theme.holo"> ... <item name="android:edittextsyle">@style/app_edittextstyle</item> ... <style> and in androidmanifest.xml have like:
<application .... android:theme="@style/app_theme"> and voila! edittext's have consistent style without me having specify style each instance.
override attribute pointing edittext style(named edittextstyle :) ) in custom theme:
<style name="app_theme" parent="@android:style/theme.holo"> <item name="android:edittextstyle">@style/app_edittextstyle</item> </style> and make custom style extend widget.edittext:
<style name="app_edittextstyle" parent="@android:style/widget.edittext"> <item name="android:background">@drawable/filled_roundededges_box_dark</item> <item name="android:textcolor">#808080</item> <item name="android:layout_height">45dip</item> </style>
Comments
Post a Comment