android - 迁移到 sdk 30 android 11 后获得额外空间
问题描述
android 11升级后有问题
我有一个需要更新到 sdk 30 的应用程序,升级后我遇到了奇怪的 UI 问题,在 appbar 下方的容器顶部添加了一个额外的空间。当我在 sdk 升级后以较低版本运行应用程序时,它看起来很好。似乎问题仅与android 11有关。请让我知道确切的问题是什么,无法弄清楚。我尝试将材料更改为稳定版本 1.2.0 和 appcompact 版本,但没有任何变化。
使用的构建工具是:30.0.0
顶部区域有一些默认边距,在代码中没有添加这样的边距。
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/toolbar_title"
style="@style/PsToolbarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"/>
</androidx.appcompat.widget.Toolbar>
<View
style="@style/Divider"
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"/>
</com.google.android.material.appbar.AppBarLayout>
这包含在协调器布局中
使用此链接进行屏幕截图:https ://i.stack.imgur.com/Jns79.png
解决方案
我有同样的问题。我不知道根本原因,但在我的情况下,问题是通过com.google.android.Material
在build.gradle
.
推荐阅读
- css - 如何在滑块图像上粘贴导航栏
- variables - 如何使用 Dockerfile 动态设置 ENV 变量
- python - Ruby 数组函数的 Numpy 等价物
- python - 如何从不同的文件类函数导入变量
- android - 如何将多个不同类型的 arraylist 传递给单个 recyclerview 适配器?
- c# - 发送 WNS 和 APNS 推送通知时命中哪个服务器 URL(PushSharp 库)
- javascript - 如何从 javascript 或 html 运行 python 代码?
- react-native - 在地图上放置标记时如何获取坐标
- android - 从 Bound Service 启动 Activity 以获得 DrawOverlays 权限但保持服务运行
- javafx - 通过 FXML 加载节点后,如何检索所有具有 fx:id 的项目?