Vote count:
0
I am setting the default look of all buttons in my application as follows. When I do this, nothing happens on click of the buttons, even though I have defined all functions correctly. In fact, when I comment out the line <item name="android:buttonStyle">@style/button</item>
, the button clicks work fine (but of course, they use the default android style). Application theme is also defined in the manifest: android:theme="@style/AppTheme"
Can someone please tell me why this is happening? Thanks.
button_shape.xml in res/drawable:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://ift.tt/nIICcg"android:shape="rectangle">
<corners
android:radius="10dp" />
<gradient
android:angle="90"
android:startColor="#6AA4ED"
android:endColor="#927BED"/>
<padding
android:left="10dp"
android:right="10dp"
android:top="12dp"
android:bottom="12dp" />
styles.xml:
<resources xmlns:android="http://ift.tt/nIICcg">
<style name="AppBaseTheme" parent="android:Theme.Light">
</style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:buttonStyle">@style/button</item>
</style>
<style name="button">
<item name="android:background">@drawable/button_shape</item>
</style>
asked 2 mins ago
Aucun commentaire:
Enregistrer un commentaire