Android: DrawerLayout(抽屉导航)1

写一个侧滑页面的布局

比如这样的效果图:



分析一下结构 整个用 LinearLaout布局结构

1、Drawer Layout 的v 4包

2、顶部的头像覆盖在渐变背景色上方, 所以使用FrameLayout,插入一个imageView覆盖在其上方,调整好marginTop距离

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/circle_bg"/>
    <ImageView
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:background="@drawable/head"/>

</FrameLayout>

3、下方是这个音乐播放器侧滑界面的一些设置,此时使用对应结构的LinearLayout,再设置内边距和背景。只写几个其他一样的

<LinearLayout
    android:orientation="vertical"
    android:layout_width="400dp"
    android:layout_gravity="left"
    android:layout_height="match_parent"
    android:background="#ffffff">
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="150dp"
        android:background="@drawable/circle_bg">

        <ImageView
            android:layout_marginTop="100dp"
            android:layout_gravity="center"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:background="@drawable/head"/>
    </FrameLayout>


    <LinearLayout
        android:layout_marginTop="30dp"
        android:padding="10dp"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:background="@drawable/setting"/>
        <Button
            android:id="@+id/btn_setting"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Setting"
            android:background="#ffffff"/>

    </LinearLayout>


    <LinearLayout
        android:layout_marginTop="30dp"
        android:padding="10dp"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:background="@drawable/wifi"/>
        <Button
            android:id="@+id/btn_wifi"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Wi-Fi"
            android:background="#ffffff"/>

    </LinearLayout>


    <LinearLayout
        android:layout_marginTop="30dp"
        android:padding="10dp"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:background="@drawable/timing"/>
        <Button
            android:id="@+id/btn_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Timing"
            android:background="#ffffff"/>

    </LinearLayout>


    <LinearLayout
        android:layout_marginTop="30dp"
        android:padding="10dp"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:background="@drawable/transfer"/>
        <Button
            android:id="@+id/btn_transfer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Transfer"
            android:background="#ffffff"/>

    </LinearLayout>

4、最后添加一个按钮就完成了。







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值