java - 如何删除工具栏上方的空间?
问题描述
我想实现一个折叠布局并尝试了这段代码,但它提供了额外的空间。我在主要活动中有一个工具栏,但在配置文件片段中,我通过(“ GlobalVar.toolbar.hide() ”,全局变量已全部全局使用var。)删除了它。即使在折叠后我也有某种重叠。
崩溃.xml
<?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"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="300dp"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<ImageView
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/toolbar_background"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"/>
<androidx.appcompat.widget.Toolbar
android:id="@+id/anim_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
解决方案
推荐阅读
- python-3.x - 如何增加 Cplex 解决方案的数量?
- c# - 如何从列表中取出每个元素并将其推送到堆栈中?
- r - 遇到 NA 时重置 cumprod
- c# - 当我在 Visual Studio 中执行时,我的 sql 查询代码不起作用
- java - 如何将某些数据放在 JTable 中的列上?
- wcf - 无法为 WCF SOAP 请求设置 ClientCredentials
- javascript - 在悬停时播放视频但使用不同的 div
- php - 在 Guzzle 6 中读取大型 JSON API 响应的正确方法是什么?
- bluetooth - CSR8510 A10 蓝牙驱动兼容 Windows 10 pro
- apache-spark - 任务所花费的火花和隔离时间