AndroidDrawerlayout实现侧滑菜单效果-创新互联

本文实例为大家分享了Drawerlayout侧滑菜单的具体代码,供大家参考,具体内容如下

成都创新互联公司是专业的南阳网站建设公司,南阳接单;提供成都网站设计、网站制作、外贸营销网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行南阳网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

1、Drawerlayout的xml布局


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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="animtest.com.example.e531.drawerlayout_demo.MainActivity">
  <!--侧拉菜单-->
  <android.support.v4.widget.DrawerLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/drlayout">

    <!--主页面的布局-->

    <FrameLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/fcontent">

    </FrameLayout>
    <!--拉菜单的布局  android:layout_gravity="start" 菜单在左边 end 菜单在右边 -->
    <RelativeLayout
      android:layout_width="240dp"
      android:layout_height="match_parent"
      android:layout_gravity="end"
      android:background="#ffff00"
      android:id="@+id/rel">

      <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/ic_launcher"
        android:id="@+id/img"/>

      <ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/lv"
        android:layout_below="@id/img"></ListView>

    </RelativeLayout>

  </android.support.v4.widget.DrawerLayout>

</RelativeLayout>

名称栏目:AndroidDrawerlayout实现侧滑菜单效果-创新互联
分享地址:https://www.cdcxhl.com/article2/ccopic.html

成都网站建设公司_创新互联,为您提供手机网站建设云服务器网站维护建站公司网站建设响应式网站

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

绵阳服务器托管