Reputation:
Look at the screenshot
Above I have the button with layer-list:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/button_yellow"/>
<item
android:top="5dp"
android:bottom="5dp"
android:left="5dp"
>
<bitmap android:src="@drawable/Export_hell_seidel_steiner"
android:gravity="center"/>
</item>
</layer-list>
<Button
android:layout_width="341dp"
android:layout_height="143dp"
android:layout_margin="3dp"
android:background="@drawable/layer1"
android:onClick="onClick"
android:text="" />
And below I have ImageButton
<ImageButton
android:layout_width="299dp"
android:layout_height="129dp"
android:background="@drawable/button_yellow"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="@drawable/Export_hell_seidel_steiner"
/>
It is possible achieve similar result for layer-list? Should I create my custom BitmapDrawable class? I need scaleType = "fitCenter" in my item inside layer-list.
Upvotes: 2
Views: 695