I want to use a switch and change its track color. So, in my opinion, nothing impressive.
My switch layout:
<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" />
and my color is "gray":
<color name="gray">#666666</color>
My problem is that the switch appears as a 1-pixel switch. This is just a small line. If I remove the “color” line, the switch will be correct (without gray, of course).
Where is my fault?
source
share