xml布局侧拉菜单

来源:互联网 发布:优芽微课制作软件 编辑:程序博客网 时间:2024/05/16 18:15
<?xml version="1.0" encoding="utf-8"?><android.support.v4.widget.DrawerLayout    xmlns:android="http://schemas.android.com/apk/res/android"    android:id="@+id/drawerlayout"    android:layout_width="match_parent"    android:layout_height="match_parent" >    <RelativeLayout        android:id="@+id/fragment_layout"        android:layout_width="match_parent"        android:layout_height="match_parent" >        <RelativeLayout            android:id="@+id/title_bar"            android:layout_width="match_parent"            android:layout_height="48dp"            android:background="#63B8FF" >            <ImageView                android:id="@+id/leftmenu"                android:layout_width="48dp"                android:layout_height="48dp"                android:padding="12dp"                android:onClick="leftmenu"                android:src="@mipmap/ic_launcher" />            <TextView                android:layout_width="wrap_content"                android:layout_height="48dp"                android:layout_centerInParent="true"                android:gravity="center"                android:text="侧拉菜单+夜间模式" />            <ImageView                android:id="@+id/rightmenu"                android:layout_width="48dp"                android:layout_height="48dp"                android:layout_alignParentRight="true"                android:padding="12dp"                android:src="@mipmap/ic_launcher" />        </RelativeLayout>        <LinearLayout            android:id="@+id/content"            android:layout_width="match_parent"            android:layout_height="match_parent"            android:layout_below="@id/title_bar"            android:orientation="vertical" />    </RelativeLayout>    <RelativeLayout        android:id="@+id/left"        android:layout_width="200dp"        android:layout_height="match_parent"        android:layout_gravity="left"        android:background="@android:color/white" >        <Switch            android:id="@+id/left_but"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="夜间模式"            android:background="#00ff00"            android:textOff="关"            android:textOn="开" />    </RelativeLayout></android.support.v4.widget.DrawerLayout>
原创粉丝点击