in Manifest
application
activity
in the layout file
example:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
2016年2月22日 星期一
2015年11月2日 星期一
Style
If many view use the same attribute,we can change it to astyle
<Button android:id="@+id/btBTB" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10dp" android:background="@drawable/orange_custom_button_background" android:padding="5dp" android:text="@string/ant_terminator" android:textColor="@color/textColor" />
change to a style
in styles.xml
<style name="OrangeButton"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:layout_margin">10dp</item> <item name="android:background">@drawable/orange_custom_button_background</item> <item name="android:padding">5dp</item> <item name="android:textColor">@color/textColor</item> </style>
After apply
<Button android:id="@+id/btBTB" style="@style/OrangeButton" android:text="@string/ant_terminator" />
訂閱:
文章 (Atom)