微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

迁移到 sdk 30 android 11 后获得额外空间

如何解决迁移到 sdk 30 android 11 后获得额外空间

android 11 升级后有问题

我有一个应用程序需要更新到 sdk 30,升级后我遇到了奇怪的 UI 问题,在应用栏下方的容器顶部添加一个额外的空间。当我在 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(至 1.3.0 版)解决。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。