Android 从文本左侧的开关按钮绘制拇指和跟踪器

Android 从文本左侧的开关按钮绘制拇指和跟踪器,android,widget,Android,Widget,在开关按钮上设置文本时,默认结果是右侧的拇指/轨迹 +-------------+----------+ | | | | Lorem Ispu | on / off | | | | +-------------+----------+ 要知道的是,是否有任何方法可以使重击/钉击器放置在文本的左侧,而无需编写自定义小部件: +-----------+-------------+ | |

在开关按钮上设置文本时,默认结果是右侧的拇指/轨迹

+-------------+----------+
|             |          |
|  Lorem Ispu | on / off |
|             |          |
+-------------+----------+
要知道的是,是否有任何方法可以使重击/钉击器放置在文本的左侧,而无需编写自定义小部件:

+-----------+-------------+
|           |             |
|  on / off | Lorem Ipsum |
|           |             |
+-----------+-------------+

谢谢:)

要设置开关的默认值,您必须用xml定义此代码

android:checked="true" 

我找到的唯一方法是将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>


我刚刚颠倒了顺序。

您的视图需要某种类型的自定义选择器吗?不需要。切换视图对我来说已经足够了,但我确实需要文本左侧的拇指和跟踪器:/