码迷,mamicode.com
首页 > 移动开发 > 详细

android的DrawerLayout用法

时间:2015-08-25 18:22:43      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:

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>

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

android的DrawerLayout用法

标签:

原文地址:http://www.cnblogs.com/gelandesprung/p/4757868.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!