xml - Android style dosen't work -
i trying add specific style button, issue it's works in themes.xml when write :
themes.xml
<style name="apptheme" parent="theme.appcompat.noactionbar"> <item name="colorcontrolhighlight">@color/background</item> <item name="colorbuttonnormal">@color/white</item> </style>
mylayout.xml
<button android:id="@+id/play" android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignparentbottom="true" android:gravity="center" android:text="play" android:textcolor="@color/guillotine_background" android:textsize="25dp" android:textstyle="bold"/>
but don't same result when use :
styles.xml
<style name="mycolorbutton" parent="apptheme"> <item name="colorcontrolhighlight">@color/background</item> <item name="colorbuttonnormal">@color/white</item> </style>
i added line button tag in mylayout.xml
mylayout.xml
style="@style/mycolorbutton"
isn't must return same result ?
colorcontrolhighlight
, colorbuttonnormal
theme attributes. styles used themes activity. not attributes of button
. if want use on button
not whole activity, use android:theme
attribute instead:
<button android:theme="@style/mycolorbutton" ... />
Comments
Post a Comment