Android layout 如何从应用程序栏布局中删除额外空间,而不是包装内容?
我正在坐标布局中使用应用程序栏布局。我的问题是,图像中以绿色显示的空间很少。我不想要这个空间。我想将选项卡布局底部与图像底部对齐。我正在使用fit系统窗口使内容显示在状态栏后面。此外,我希望内容显示在导航栏后面,使导航栏透明。如何实现这一点?Android layout 如何从应用程序栏布局中删除额外空间,而不是包装内容?,android-layout,scroll,android-coordinatorlayout,android-appbarlayout,Android Layout,Scroll,Android Coordinatorlayout,Android Appbarlayout,我正在坐标布局中使用应用程序栏布局。我的问题是,图像中以绿色显示的空间很少。我不想要这个空间。我想将选项卡布局底部与图像底部对齐。我正在使用fit系统窗口使内容显示在状态栏后面。此外,我希望内容显示在导航栏后面,使导航栏透明。如何实现这一点? <?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout xmln
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:padding="0dp"
app:liftOnScroll="true">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:background="@android:color/transparent"
app:statusBarScrim="@android:color/white"
app:contentScrim="@android:color/white"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<ImageView
android:layout_width="0dp"
android:layout_height="0dp"
android:contentDescription="@string/image"
android:scaleType="centerCrop"
android:src="@drawable/android"
app:layout_constraintDimensionRatio="16:9"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin"
android:layout_gravity="bottom|center"
android:gravity="bottom|center">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabMaxWidth="0dp"
app:tabTextColor="#55d400"
android:background="@android:color/transparent"
app:tabSelectedTextColor="@color/colorPrimaryDark"
app:tabIndicatorColor="@color/colorPrimaryDark"
app:tabTextAppearance="@style/TabTextAppearance">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/image" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/video" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/audio" />
</com.google.android.material.tabs.TabLayout>
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>