android - 在 AVD Manager 的小屏幕上,屏幕顶部变得太大
问题描述
当我在 AVD 管理器中使用小屏幕时,屏幕顶部变得太大。在更大的屏幕上这是正常的。(它是工具栏上方的小线)对于activity-main和content-main中的布局,我使用了“match-parent”你知道那里发生了什么以及如何修复它吗?
非常感谢法比安
这是我在 content_main 中的代码:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:showIn="@layout/activity_main">
</androidx.constraintlayout.widget.ConstraintLayout>
这是我的activity_main:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_main" />
<io.github.yavski.fabspeeddial.FabSpeedDial
android:id="@+id/addButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_add_white_24dp"
app:fabGravity="bottom_end"
app:fabMenu="@menu/menu2">
</io.github.yavski.fabspeeddial.FabSpeedDial>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
我刚刚发现没有应用程序的屏幕也是这样的。可能是 AVD 管理器的问题,而不是代码的问题。
解决方案
推荐阅读
- javascript - 如何修复 HTTP 中的“重定向过多”错误
- react-native - Google OAuth 无法在 react-native-app-auth 中使用
- c# - 如果一个类型与其他类型存在多对多或一对多关系,如何获取?
- mysql - SQL MYSQL 的结果中的内部数组
- cmake - 如何让 CLion 使用不同的 CMake 配置进行调试和发布?
- ubuntu - 如何按顺序运行多个 .sbatch 脚本
- python - 在 anaconda 中安装 dlib 时遇到问题
- c - 循环没有超出预期的结果
- mysql - 如何修复“SchemaUpdate - HHH000319:无法获取数据库元数据”,因为用于查询的数据包太大(5,526,600 > 65,535)
- python-3.x - 悬停时在 bar 上显示文本,在 broken_barh 中