【问题标题】:Gap between title and fragment in Bottom Navigation Activity template底部导航活动模板中标题和片段之间的间隙
【发布时间】:2020-03-26 11:52:53
【问题描述】:
我查看了 Android Studio 的 Bottom Navigation Activity 项目模板,发现这是“标题”和“主页片段”之间的差距。我添加的唯一更改是 android:background="@color/colorAccent" 到 fragment_home.xml 以突出显示差距?
这个间隙有什么用吗?如何摆脱这种差距?
【问题讨论】:
标签:
android
android-studio
android-layout
android-fragments
【解决方案1】:
找到原因。这是由于在“activity_main.xml”中找到的android:paddingTop="?attr/actionBarSize"。
<?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"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="?attr/actionBarSize"
>