Reputation: 21
Style.xml File(AppTheme is the theme of my app and it is inheriting materiallightdarkactionbar theme)
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorForeground">@color/holo_orange_light</item>
<item name="android:buttonStyle">@style/newbuttonstyle</item>
</style>
<style name="newbuttonstyle" parent="@android:style/Widget.Button">
<item name="android:backgroundTint">#acd9e6</item>
</style>
</resources>
I am designing a calculator and this is the keypad for it.....rather than individually setting background tint for all the buttons I want to change the style of all my buttons in one go using style.xml....can i do so?
In this I am using buttonStyle and still it is not working
<item name="android:buttonStyle">@style/newbuttonstyle</item>
Upvotes: 2
Views: 17954
Reputation: 4448
You can follow this question, hope it will be work for you and clear your style portion: Android Material Design Button Styles
Upvotes: 0
Reputation: 3964
in your XML file
<Button
style="@style/MyButtonStyle"
android:id="@+id/btnSignIn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="my button"/>
in style.xml file add this code.
<style name="ButtonStyle" parent="@android:style/Widget.Button">
<item name="android:layout_width">fill_parent</item>
<item name="android:textColor">@color/black</item>
<item name="android:textSize">15sp</item>
<item name="android:padding">10dp</item>
<item name="android:textStyle">bold</item>
<item name="android:background">@color/colorPrimary</item>
<item name="android:gravity">center</item>
</style>
change Style items as per your requirements.
Upvotes: 2
Reputation: 11188
<style name="newbuttonstyle" parent="@android:style/Widget.Button">
<item name="android:background">#acd9e6</item>
</style>
I am using above code in my application and its working fine.i think set background instead of backgroundTint. May be its working .
check this link: ReferenceLink
and its some issue in tintbackground in lolipop.so you have to check in below lolipop.
Upvotes: 1