Android SwitchCompat 的垂直对齐方式?

Vertical alignment of an Android SwitchCompat?

在Android中,是否可以垂直对齐 SwitchCompat ,即将文本放在开关上方而不是开关左侧?

看起来不像。 你可以用 LinearLayout 包装 TextView 和 SwitchCompat 以获得你想要的结果。

你在找这样的东西吗..?

试试这个

<LinearLayout
    android:id="@+id/switchLayout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:padding="5dp"
    android:orientation="vertical">
    <TextView
        android:id="@+id/switchTxt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#000000"
        android:text="Switch"/>
    <Switch
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:rotation="90"
        android:layout_margin="10dp"
        android:layout_marginLeft="3dp"
        android:id="@+id/switch1" />
</LinearLayout>