android的DrawerLayout用法

DrawerLayout的关键点(我认为的)就在于layout文件的layout_gravity属性的值,只有左右,两种选择,不能从上下滑出来,就算有这个效果也不是这个套路弄出来的。

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    android:id="@+id/slidepanellayout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/a"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="a"/>

    <TextView
        android:id="@+id/b"
        android:layout_gravity="end"
        android:background="#0000ff"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="b"/>
</android.support.v4.widget.DrawerLayout>

至于颜色默认是透明,必须加个色,不然是重复的。

posted @ 2015-08-25 16:36  _Gelandesprung  阅读(388)  评论(0编辑  收藏  举报