<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawerlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.administer.drawlayoutdemo.MainActivity">
<RelativeLayout
android:id="@+id/relativelayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/left_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="开启左边菜单栏" />
<Button
android:id="@+id/right_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="开启右边菜单栏"
android:layout_alignParentRight="true"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/left"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="#f00">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="左边布局" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/right"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="#00f">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="右边布局" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
drawerLayout.addDrawerListener(new DrawerLayout.DrawerListener() {
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
/**
* 抽屉滑动时,调用此方法
* */
}
@Override
public void onDrawerOpened(View drawerView) {
/**
* 抽屉被完全展开时,调用此方法
* */
}
@Override
public void onDrawerClosed(View drawerView) {
/**
* 抽屉被完全关闭时,调用此方法
* */
}
@Override
public void onDrawerStateChanged(int newState) {
/**
* 抽屉状态改变时,调用此方法
* */
}
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有