Hey. I think that the child widget you are using may be wrong, it must be android:Widget.Button for API version 21 or earlier, for later version 21 or higher you should use `android: Widget.Material.Button. Let them say that the default style should look lower.
res/values/styles.xml <resources> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:buttonStyle">@style/AppTheme.Button</item> </style> <style name="AppTheme.Button" parent="android:Widget.Button"> <item name="android:background">@color/my_color</item> <item name="android:textColor">@android:color/white</item> </style> </resources>
For API version 21, the resource style file should look like (res / values-v21 / style.xml)
<resources> <style name="AppTheme.Button" parent="android:Widget.Material.Button"> <item name="android:background">@color/my_color</item> <item name="android:textColor">@android:color/white</item> </style> </resources>
Thanks, let me know if you have any questions.
Bhavdip Sagar Apr 25 '15 at 4:50 2015-04-25 04:50
source share