문제

I'm trying to create a rounded image button using the code below which works when you don't declare a src image. However when you do, it just places the image in but without the rounding effect on it.

style.xml

<ImageButton
    android:id="@+id/imageButton2"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:layout_below="@+id/imageButton1"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="41dp"
    android:src="@drawable/ellyfish"
    android:background="@drawable/roundcorner"
    />

roundcorner.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#33DDFF" />        
    <corners android:radius="50dp" />
</shape>
도움이 되었습니까?

해결책

Make your src image round, or make it transparent so you can see the rounded background behind it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top