Button with rounded edge and shadow using 9 patch

1

Good morning! I would like to put shadow on the images and buttons of my application and I am trying to use the features of the 9 patch. But it's not working very well, the height of the png that I'm using as a shadow always gets bigger:

xmlofImageButton:

<ImageButtonandroid:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/btnentrarfb"
        android:background="@drawable/shadow"
        android:src="@drawable/botaofacebook" />

Another problem I'm having is with the buttons, since I already have a style defined for them and I used an xml background to leave the rounded edges, so I'm not sure how to put the shadow. I tried, but it is not having any effect, it only has the rounded edges.

styleButton.xml:

<style name="styleButton">
        <item name="android:background">@drawable/screen_border</item>
        <item name="android:textColor">@color/icons</item>
    </style>

screen_border.xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/shadow"/>
    <item>
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:padding="10dp"
            android:shape="rectangle">
            <solid android:color="@color/primary" />
            <corners
                android:bottomLeftRadius="10dp"
                android:bottomRightRadius="10dp"
                android:topLeftRadius="10dp"
                android:topRightRadius="10dp"/>
        </shape>
    </item>
</layer-list>

Button xml:

 <Button
        android:id="@+id/btnentrar"
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:text="@string/btn_entrar"
        style="@style/estiloBotao"
        android:textColor="@color/branco" />
    
asked by anonymous 30.08.2016 / 17:47

0 answers