0

我有一個摺疊式工具設置是這樣的:
Android的摺疊式工具有太多的填充

<android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/collapsing_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      app:collapsedTitleGravity="right" 
      app:paddingStart="5dp" 
      app:titleEnabled="true" 
      app:expandedTitleGravity="top|center_horizontal" 
      app:contentScrim="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed|snap" 
      app:expandedTitleMarginEnd="0dp" 
      app:expandedTitleMarginStart="0dp" 
      app:expandedTitleMarginTop="0dp"> 

     <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> 
      <ImageView 
        android:id="@+id/backdrop" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:fitsSystemWindows="true" 
        android:scaleType="centerCrop" 
        app:layout_collapseMode="parallax"/> 
      <com.ashojash.android.customview.VenueScoreIndicator android:layout_width="match_parent" 
                   android:layout_height="match_parent" 
                   android:layout_alignParentBottom="true" 
                   android:id="@+id/venueScoreIndicator"/> 
     </RelativeLayout> 

     <!-- As our statusBar is transparent below and content is moved behind our toolbar has to include the padding on top so we use this area --> 
     <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:paddingRight="8dp" 
       app:layout_collapseMode="pin" 
       app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> 

    </android.support.design.widget.CollapsingToolbarLayout> 

</android.support.design.widget.AppBarLayout> 

image showing the extra padding
正如你看到有在頂部一些額外的填充和倒塌標題的下方,我不看到任何選項將app:collapsedTitlePaddingTop設置爲0dp。
我失蹤了什麼?

回答

0

我認爲問題是帶有match_parent高度的RelativeLayout。嘗試刪除它,如果這個問題解決了,不知何故線制佈局不match_parent高度

0

懇求試試這個.....這將有助於

<?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" 
android:id="@+id/main_content" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@color/white"> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/appbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

    <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:layout_scrollFlags="scroll|enterAlways|snap" 
     app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> 

    <android.support.design.widget.TabLayout 
     android:id="@+id/tabLayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" /> 

</android.support.design.widget.AppBarLayout> 

<android.support.v4.view.ViewPager 
    android:id="@+id/viewPager" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

相關問題