侧滑布局

 <!-- 第一个元素是主视图-->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@color/colorPrimaryDark">

            <ImageView
                android:id="@+id/iv"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:src="@mipmap/ic_launcher"/>

            <TextView
                android:layout_width="wrap_content"

                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:text="标题"/>
        </RelativeLayout>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="这是主视图"/>
    </LinearLayout>
    <!-- 第二个元素是测滑页面-->
    <LinearLayout
        android:layout_width="350dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@color/colorAccent">

        <ImageView
            android:id="@+id/iv2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@mipmap/ic_launcher"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="这是测滑页面"/>
    </LinearLayout>

猜你喜欢

转载自blog.csdn.net/qq_41880256/article/details/81133058