Same style for every row in Android's TableLayout -
is there way in android xml set same style (or style paramerers, padding) rows in tablelayout @ once?
what avoid doing is:
<tablelayout> <tablerow style="@style/mystyle">...</tablerow> <tablerow style="@style/mystyle">...</tablerow> <tablerow style="@style/mystyle">...</tablerow> <tablerow style="@style/mystyle">...</tablerow> ... </tablelayout>
you can define own styles creating xml files on res/values directory. so, let's suppose want have red , bold text, create file content:
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="myredtheme" parent="android:theme.light"> <item name="android:textappearance">@style/myredtextappearance</item> </style> <style name="myredtextappearance" parent="@android:style/textappearance"> <item name="android:textcolor">#f00</item> <item name="android:textstyle">bold</item> </style> </resources>
you can name want, instance res/values/red.xml
. then, thing have using view in widgets want, instance:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <textview style="@style/myredtheme" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="this red, isn't it?" /> </linearlayout>
for more referense click here
Comments
Post a Comment