Set a consistent theme for all the editTexts in Android -


i have finished making app. now, want reset edittexts have layout width fill parent instead of wrap content.

android:layout_width="fill_parent" 

while edittexts are

android:layout_width="wrap_content" 

is there way can in style xml file, instead of individually in each layout? have styles.xml

<style name="apptheme" parent="android:theme.light">       <item name="android:fontfamily">verdana</item>     <item name="android:edittextstyle">@style/edittextstyle</item> </style>  <style name="edittextstyle" parent="@android:style/widget.edittext">     <item name="android:layout_width">fill_parent</item>     <item name="android:textcolor">#808080</item> </style> 

but i'm getting exception saying layout_width must specified. exception:

07-15 11:13:34.872: e/androidruntime(1195): java.lang.runtimeexception: unable start activity componentinfo{com.passwordkeeper.ui/com.passwordkeeper.ui.activitylogin}: java.lang.runtimeexception: binary xml file line #29: must supply layout_width attribute. 

any easy way out or have change attribute in edittext's individually?

you can try one. here part of manifest file need change call custom theme (the custom theme called here apptheme:

<application android:name="yourapplication" android:theme="@style/apptheme" > 

then in file styles.xml, create , customize custom theme:

<style name="apptheme" parent="@android:style/theme.holo.light">  <item name="android:typeface">yourtypeface</item> </style> 

you can add parameters need inside style. apply style textviews.


Comments