如果我使用 constraintLayout 作为根布局,DrawerLayout 不可见,它仍然可以打开和关闭,但它不可见。如果我将 drawerLayout 设置为 root 或其他布局(例如 RelativeLayout 或 LinearLayout),它就会起作用。知道为什么会这样吗?
这行不通
<ConstraintLayout>
<DrawerLayout>
这些作品
<DrawerLayout>
<ConstraintLayout>
<LinearLayout>
<DrawerLayout>
<RelativeLayout>
<DrawerLayout>
最佳答案
DrawerLayout
充当窗口内容的顶级容器,允许交互式“抽屉” View 从一个或窗口的两个垂直边缘。
这就是为什么你不能将它作为其他 ViewGroups
的 child 。
查看引用 here
关于android - ConstraintLayout 内的 DrawerLayout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54037138/