android - Jetpack 撰写模态抽屉打开手势
问题描述
我在模态抽屉布局上注意到的一点是手势不必从屏幕边缘开始。您只需在屏幕宽度的一半上做手势,它仍然会打开。这是现在的预期行为吗?或者这是一个问题?如果这是一个问题,任何人都知道有什么好的解决方法吗?谢谢
解决方案
因为这个问题需要一段时间才能解决。我的解决方案是使用这样的视图绑定系统
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.compose.ui.platform.ComposeView
android:id="@+id/composeNavContent"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</androidx.drawerlayout.widget.DrawerLayout>
然后在我的作曲上
AndroidViewBinding(ActivityMainBinding::inflate) {
// other content here
composeNavContent.setContent {
NavContent(navController = navController, drawerLayout)
}
}
此解决方法解决了我的抽屉具有正确手势(从边缘)的问题。直到这
推荐阅读
- java - JFileChooser filter for file names
- codeigniter-3 - codeigniter not reliable when updating queries
- r - Connecting to a Remote Cloudera Spark Cluster using Sparklyr with the method Livy
- java - Dagger-2: How to wire up my program, if I have to inject dependencies at runtime?
- docker - How can I change the hosts file in windows docker container
- html - Adding a Scroll bar to flexbox with overflowing content
- ruby-on-rails - Travis CI 笑话:未找到
- c# - RijndaelManaged false 解密结果
- amazon-web-services - 为什么(许多)IAM 永久身份比根身份更安全?
- c# - VSTO Ribbon - 通用/抽象按钮单击事件?