user3082880
user3082880

Reputation: 49

Android custom button style not working

I have this style on my styles.xml:

<style name="btnStyleGenoa" parent="@android:style/Widget.Button">
    <item name="android:textSize">15sp</item>
    <item name="android:textStyle">bold</item>
    <item name="android:textColor">#FFFFFF</item>
    <item name="android:gravity">center</item>
    <item name="android:shadowColor">#000000</item>
    <item name="android:shadowDx">1</item>
    <item name="android:shadowDy">1</item>
    <item name="android:shadowRadius">0.6</item>
    <item name="android:background">@drawable/custom_btn_genoa</item>
    <item name="android:padding">10dip</item>
</style>

I also have this custom_btn_genoa.xml on drawable folder:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:state_pressed="true" >
        <shape android:shape="rectangle"  >
            <corners android:radius="3dip" />
            <stroke android:width="1dip" android:color="#20534e" />
            <gradient  android:angle="-90"  android:startColor="#062d30" android:endColor="#4c898e"  />
        </shape>
    </item>
    <item android:state_focused="true">
        <shape android:shape="rectangle"  >
            <corners android:radius="3dip" />
            <stroke android:width="1dip" android:color="#20534e" />
            <solid  android:color="#125156"/>
        </shape>
    </item>
    <item >
        <shape android:shape="rectangle"  >
            <corners android:radius="3dip" />
            <stroke android:width="1dip" android:color="#20534e" />
            <gradient  android:angle="-90"  android:startColor="#4c898e" android:endColor="#125156" />
        </shape>
    </item>
</selector>

Finally, i have this button:

 <Button
        android:text="@string/change_but"
        android:textSize="15dp"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_marginRight="30dp"
        android:id="@+id/change_but"
        android:onClick="onChangeClicked"
        style=”@style/btnStyleGenoa”
 />

The button does not use the desired style. Last line in button (style) says "attribute value expected. Any thoughts?

(Note, i found this code on a website, it's not mine)

Upvotes: 1

Views: 1500

Answers (1)

kamilmasta
kamilmasta

Reputation: 129

You must replace style=”@style/btnStyleGenoa” to style="@style/btnStyleGenoa"

Working like a charm.

button

Upvotes: 1

Related Questions