我在 imagebuttons 上使用了两个可绘制形状的 xml 文件。一个包含一个环,另一个包含一个小到足以放入较大环的椭圆形,类似于单选按钮。在这张图片http://imgur.com/mYPALoT中,您可以看到(从左到右)环、较小的中间椭圆,以及显示两者的图层列表视图的组合图像。这不起作用,而是显示一个完整的填充椭圆。
这是环xml:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="ring"
android:innerRadiusRatio="3"
android:thickness="1dp"
android:useLevel="false">
<solid android:color="#1976D2" />
<size
android:height="20dp"
android:width="20dp" />
</shape>
这是椭圆形的xml:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#1976D2" />
<size
android:height="7dp"
android:width="7dp" />
</shape>
这是层列表xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ring_select" />
<item android:drawable="@drawable/ring_center" />
</layer-list>
我不熟悉图层列表,因为我是 android 新手。我究竟做错了什么?