关于 xml:Android Switch Widget: Setting android:track 会导致 thumb 和 track 不显示 | 珊瑚贝

Android Switch Widget: Setting android:track causes thumb and track to not show up


我无法自定义 Android Switch 小部件的外观。我有自定义 xml 可绘制对象,我想将其用于拇指(通常显示”开”或”关”的小按钮部分)和Rails(拇指滑过的背景)。当我使用 android:thumb 设置拇指时,它工作正常。当我设置Rails时(无论是否设置了拇指),开关完全消失,我只剩下文本显示。

这是我只应用拇指时的代码:

1
2
3
4
5
6
7
8
9
<com.blahblahblah.blah.CustomSwitch
   android:id=“@+id/switch_1”
   android:layout_width=“wrap_content”
   android:layout_height=“wrap_content”
   android:textOff=“Off”
   android:textOn=“On”
   android:text=“Something Awesome”
   android:textColor=“@android:color/black”
   android:thumb=“@drawable/custom_switch_thumb” />

这是预览窗口中的样子:

enter

并且应用了Rails:

1
2
3
4
5
6
7
8
9
<com.blahblahblah.blah.CustomSwitch
    android:id=“@+id/switch_1”
    android:layout_width=“wrap_content”
    android:layout_height=“wrap_content”
    android:textOff=“Off”
    android:textOn=“On”
    android:text=“Something Awesome”
    android:textColor=“@android:color/black”
    android:track=“@color/track_color” />

应用曲目的预览窗口:

enter



来源:https://www.codenong.com/18659446/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_9298.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?