【发布时间】:2014-10-01 10:08:57
【问题描述】:
我想使用 Switch 并更改其轨道颜色。所以在我看来没什么了不起的。
我的 Switch 布局:
<Switch
android:id="@+id/Switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:track="@color/gray"
android:textOn="@string/on"
android:textOff="@string/off"
android:text="@string/musiconoff" />
和我的颜色“灰色”:
<color name="gray">#666666</color>
我的问题是 Switch 显示为 1 像素 Switch。这只是一条小线。如果我删除“颜色”行,则开关是正确的(当然没有灰色)。
我的错在哪里?
【问题讨论】:
-
在 android:track="@android:color/darker_gray"上使用我的答案我认为你的@color/gray 有问题
-
别忘了给我投票
-
你能接受@Sector11 的回答吗,因为它只适用于任何情况。
标签: android colors widget android-switch