1
Good morning! I would like to put shadow on the images and buttons of my app and I am trying to use the features of the 9 patch. However it is not working very well, the png height I am using as shadow always gets bigger:
xml of ImageButton
:
<ImageButton
android: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, because I already have a style defined for them and used as background an xml to make the edges rounded, so I’m not sure how to put the shadow. I tried, but it’s having no effect, it’s just 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>
xml button:
<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" />