zoukankan      html  css  js  c++  java
  • android 侧滑菜单

    就是用手一滑才出现,占手机半个多屏幕的菜单。为了美观和页面转跳,很多时候要用到。

    实现的话就是使用官方的DrawerLayout,注意这个布局一定要是最顶层的布局。

    在DrawerLayout里面直接写代码的话,添加的东西是在侧滑菜单里面的。

    要是正文内容(就是没出现侧滑菜单的那部分)的东西,要写在FrameLayout里面。当然FrameLayout是在DrawerLayout里面的。

    看看效果图:

    正文部分(有个hehe按扭):

    侧滑部分:

    我们要做的事情,其实就是往侧滑菜单还有正文部分添加内容和功能,具体的代码如下:

    <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/id_drawerlayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

    <FrameLayout android:id="@+id/id_framelayout" android:layout_width="match_parent" android:layout_height="match_parent" > 这里是正文部分的内容(省略) </FrameLayout>


    <LinearLayout android:id="@+id/id_drawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:background="#E0EEE0" android:orientation="vertical" >     这里是菜单里面的内容 </LinearLayout> </android.support.v4.widget.DrawerLayout>
    
    
  • 相关阅读:
    python——数据库操作
    【笔试】T实习生2014 总结
    【JS】Intermediate6:jQuery
    【JS】Intermediate5:Scope
    【JS】Intermediate4:JSON
    【JS】Intermediate3:AJAX
    【JS】Intermediate2:Events and Callbacks
    【JS】Intermediate1:The DOM
    【JS】Beginner9:Arrays
    【JS】Beginner8:Objects
  • 原文地址:https://www.cnblogs.com/wzben/p/5163689.html
Copyright © 2011-2022 走看看