当我在AVD Manager中使用小屏幕时,屏幕顶部变得太大。在大屏幕上,这是正常现象。 (这是工具栏上方的小线) 对于活动主体和内容主体中的布局,我使用了“ 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-Manager而不是代码的问题。