如题,我想实现滑动菜单功能
这是我的布局代码:
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<Button
android:id="@+id/learnNew"
android:layout_width="133dp"
android:layout_height="63dp"
android:layout_marginStart="64dp"
android:layout_marginTop="232dp"
android:text="学习"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/userWelcome"
android:layout_width="173dp"
android:layout_height="52dp"
android:layout_marginStart="52dp"
android:layout_marginTop="96dp"
android:text="TextView"
android:textSize="34sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="start"
android:background="#FFF"
android:text="This is menu"
android:textSize="30sp"
/>
</androidx.drawerlayout.widget.DrawerLayout>
但是显示出来的却是这个样子:
划也划不动,不过还能点击到被遮盖的按钮,这是怎么回事?