我已经使用 Android Studio 模板创建了一个 Scrolling Activity,这创建了一个 activity.xml 和一个 content.xml,它包含在具有 NestedScrollView 的 activity.xml 中,我在其中添加了来自适配器的 ListView 提要,起初它只显示一个项目,所以我以编程方式将它的大小设置为固定值,以便它实际上显示所有项目,我能够毫无问题地做到这一点,并且 NestedScrollView 毫无问题地包装了 ListView,但是有通过向所有元素添加背景颜色,我意识到 NestedScrollView 下方的空白区域来自 CoordinatorLayout,CoordinatorLayout 是活动中的主要标签。xml,但我无法弄清楚如何删除这个空白空间,因为如果我在 CoordinatorLayout 上使用 wrap_content ,它实际上会出于某种原因将我的内容修剪到屏幕的一半。
其他值得一提的是,如果我水平旋转手机,这个空白空间不会显示,只会出现在垂直位置。还,
有谁知道这可能是什么原因造成的?没什么大不了的,我什至可能会像这样离开它,但这对我来说很烦人,我无法弄清楚发生了什么。
这是我的activity.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.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"
android:background="#00ff00" //Green
tools:context=".VenueActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/frog"
android:scaleType="centerCrop"
/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_venue"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_favorite_white_24dp"
app:layout_anchor="@id/app_bar"
app:layout_anchorGravity="bottom|end" …Run Code Online (Sandbox Code Playgroud) android android-scrollview android-studio android-coordinatorlayout nestedscrollview
android ×1