Android QQ 左右滑动菜单弹出效果怎么实现

2025-03-12 19:40:47
推荐回答(1个)
回答1:

您好,这个可以使用MD的一些布局,也可以自定义一些空间来实现左划菜单

这里给你推荐使用DrawerLayout抽屉布局,下面贴上我的代码
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">

android:layout_width="match_parent"
android:layout_height="match_parent">


android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize" />





android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start" ---------------------1
app:headerLayout="@layout/drawer_header"------2
app:menu="@menu/menu_drawer" />



1:start为左侧策划,end为右侧侧滑
2:这里为qq策划中上半部分,我在这里直接引用了另一个布局