我是android编程的新手。我想自定义switch
如下图。
而且我还想控制文本和开关之间的空格。
我必须在我的交换机上添加 pro 标签进行哪些更改?
我是android编程的新手。我想自定义switch
如下图。
而且我还想控制文本和开关之间的空格。
我必须在我的交换机上添加 pro 标签进行哪些更改?
您需要创建自己的 Switch 样式。例如:
<Switch
android:id="@+id/switch1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:thumb="@drawable/apptheme_switch_inner_holo_light"
app:track="@drawable/apptheme_switch_track_holo_light" //This is what you need to customize with your own drawable that has "pro" on it
app:textOn="ON"
app:textOff="OFF
/>
使用 xml 属性(如边距、填充、对齐等)来调整间距