【发布时间】:2016-09-20 07:49:31
【问题描述】:
我想让我的按钮有不同颜色的环形。我做到了,它正在我正在调试的设备上工作。 代码 black_round_button.xml 位于 drawable-v21
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="ring">
<solid android:color="@color/black" />
按钮代码是
<Button
android:id="@+id/button31"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/black_round_button"
android:onClick="countClick"
android:text="@string/zero" />
在我调试的设备(Android 5.0.2)上看起来不错: black ring shape
但是!!!当我开始在其他设备(android 4.4.4、Android 5.1、其他)上调试时,我发现我的任何形状环都不起作用。看起来像: no black ring shape
所以,我不知道为什么会这样。昨天我在 5 个不同的设备上测试它(其中 3 个是虚拟的,2 个是真实的),只有在我的设备上它才能按我的预期工作。
【问题讨论】: