在开关按钮上设置文本时的默认结果是右侧的缩略图/轨道
+-------------+----------+
| | |
| Lorem Ispu | on / off |
| | |
+-------------+----------+
要知道有没有什么方法可以让thump/tacker 被放置在文本的左侧而无需编写自定义小部件:
+-----------+-------------+
| | |
| on / off | Lorem Ipsum |
| | |
+-----------+-------------+
谢谢:)
最佳答案
我找到的唯一方法是将 Switch 和 TextView 包裹在 LinearLayout 中:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.SwitchCompat
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your text:"/>
</LinearLayout>
希望对您有所帮助。 想法与此处提到的相同:How to show android checkbox at right side?我只是颠倒了顺序。
关于android - 从文本左侧的切换按钮绘制拇指和跟踪器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27736948/