我有一个ImageButton,我用一个形状将它转换成一个圆圈。但是,当我尝试更改ImageButton的颜色时,该形状不起作用,我可以采取什么措施来修复它?ImageButton在android中的形状
-4
A
回答
0
您可以使用库:CustomShapeImageView
例如:
<com.meg7.widget.CustomShapeImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:src="@drawable/sample"
app:shape="circle"
android:scaleType="centerCrop" />
1
我的代码是在这里:
形状:
<?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的项目:
<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"/>
+0
请告诉我选择的,而不是形状绘制的点?你甚至在这里使用/引用它呢? – petey
相关问题
- 1. android形状内的形状
- 2. android中的形状
- 3. 具有选定状态的Android ImageButton?
- 4. TableLayout中的Android ImageButton
- 5. Android ImageButton按下状态不变
- 6. Android中的图形形状3D
- 7. 的ImageButton的Android
- 8. 在Android中移动的形状
- 9. 在android中没有边框的形状
- 10. 形状不会出现在ImageButton使用选择器
- 11. 如何在Android中将矩形形状添加到矩形形状
- 12. 如何在RecyclerView中设置自定义形状的ImageButton的背景?
- 13. onSaveInstanceState ImageButton的保存状态
- 14. 在Android中填充ImageButton中的空间
- 15. 如何在android上获取imageButton的可点击状态
- 16. 在android的对话框imageButton?
- 17. Android位图形状菱形
- 18. 用不同的点击状态创建不规则形状的ImageButton
- 19. 在android中绘制填充形状mapview
- 20. 在Android中分层两种形状
- 21. 在android中更改图像形状
- 22. 如何在Android中绘制形状
- 23. 在Android中移动一个形状
- 24. 在Android中使用转换的ImageButton
- 25. 在Android中使用TextView的ImageButton
- 26. 在Android中调整ImageButton的大小
- 27. 如何在形状达到另一个形状时停止形状(Android)?
- 28. SVG到Android形状
- 29. Android形状动画
- 30. android - 动画形状
请分享你的工作,这样的人可以帮你 – Quantico