I have a ImageButton and I used a shape to transform it in a circle. But when I try to change the color of the ImageButton the shape doesn't work, what can I do to fix it?
Asked
Active
Viewed 1,109 times
-4
-
please share your work , so people can help you – Quantico Dec 03 '15 at 15:36
2 Answers
1
My code is here:
Shape:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/material_grey_50" />
<stroke android:color="@color/material_grey_500"
android:width="1dp" />
<corners android:radius="10dp" />
</shape>
</item>
</selector>
GridView Item:
<ImageButton
android:id="@+id/buttonRemove"
android:layout_width="0dp"
android:layout_height="43dp"
android:layout_weight="5"
android:background="@color/material_cyan_300"
android:src="@mipmap/ic_action_remove"/>

L . Android
- 33
- 10
-
Whats the point of the selector instead of shape drawable? How are you even using/referencing it here? – petey Dec 03 '15 at 16:15
0
You can to use library: CustomShapeImageView
for example:
<com.meg7.widget.CustomShapeImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:src="@drawable/sample"
app:shape="circle"
android:scaleType="centerCrop" />

ArtKorchagin
- 4,801
- 13
- 42
- 58