3.25

swtich开关
• 所花时间:2
• 代码行数:311
• 博客容量:1
• 代码如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="是否打开开关"
            android:layout_weight="1"
            />
        <Switch
            android:layout_weight="1"
            android:layout_gravity="right"
            android:id="@+id/sw_a"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:padding="5dp"/>

    </LinearLayout>

</LinearLayout>
posted @ 2024-03-25 19:27  aallofitisst  阅读(8)  评论(0)    收藏  举报