0
点赞
收藏
分享

微信扫一扫

Android 项目总结(View控件之DrawerLayout)

Jonescy 2022-01-06 阅读 82


菜单:添加多个功能选项 布局。

流行的侧滑。
DrawerLayout:支持拖动显示或者隐藏 内容的控件。 V4的控件。
FrameLayout:

谷歌提供的支持侧滑菜单的一个布局 。提供一个兼容包v4
1.布局 页面内容 菜单内容
2.DrawerLayout包裹这两块布局

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<!-- 页面 -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >

<include layout="@layout/activity_main"/>
</FrameLayout>
<!-- 菜单 -->
<FrameLayout
android:layout_width="200dp"
android:layout_gravity="start"
android:layout_height="match_parent" >

<include layout="@layout/menu"/>
</FrameLayout>
</android.support.v4.widget.DrawerLayout>


 

举报

相关推荐

0 条评论