1

我是android编程的新手。我想自定义switch如下图。

                 在此处输入图像描述

而且我还想控制文本和开关之间的空格。

我必须在我的交换机上添加 pro 标签进行哪些更改?

4

1 回答 1

0

您需要创建自己的 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 属性(如边距、填充、对齐等)来调整间距

于 2014-09-14T09:25:06.453 回答