AppbarLayout随机添加和删除底部填充

时间:2018-07-28 21:24:29

标签: android android-appbarlayout android-nestedscrollview android-collapsingtoolbarlayout

Image with no padding Image with padding

如您所见,每次我打开此活动时,都会随机删除或添加appbarlayout下面的填充。我知道问题可能是由fitsystemwindow = true属性引起的,因为设置此属性后,我对填充没有任何控制权。我希望自己能够控制此填充,知道我可能做错了什么或如何解决该问题?这是我的代码:

  <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:fitsSystemWindows="true"
        android:layout_height="200dp"
        android:theme="@style/AppTheme.AppBarOverlay"
        app:layout_behavior="com.bulgaria.mezdra.ivanmihaylovivanov.bulgarito.components.FlingBehavior">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsingToolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            android:visibility="visible"
            app:contentScrim="@color/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:scrimAnimationDuration="0">

            <com.bulgaria.mezdra.ivanmihaylovivanov.bulgarito.components.FrameLayoutWithAspectRatio
                android:id="@+id/photo_container"
                android:layout_width="match_parent"
                android:layout_height="@dimen/destination_image_view_with_aspect_ratio_height"
                android:fitsSystemWindows="true">

                <android.support.v4.view.ViewPager
                    android:id="@+id/swipeImagesViewPager"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />

                <me.relex.circleindicator.CircleIndicator
                    android:id="@+id/circleIndicator"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/spacing_xlarge"
                    android:layout_gravity="bottom" />
            </com.bulgaria.mezdra.ivanmihaylovivanov.bulgarito.components.FrameLayoutWithAspectRatio>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?android:attr/actionBarSize"
                android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

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


    <android.support.v4.widget.NestedScrollView
        android:clipToPadding="false"
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/white"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

这是样式

     <style name="AppTheme.DestinationDetail" parent="AppTheme">
       <item name="android:windowEnterTransition">@transition/card_exit</item>
       <item name="android:windowTranslucentStatus">true</item>
       <item name="android:windowTranslucentNavigation">true</item>
       <item name="android:windowContentTransitions">true</item>
       <item name="android:windowDrawsSystemBarBackgrounds">true</item>
       <item name="android:statusBarColor">@android:color/transparent</item>
       <item name="android:navigationBarColor">@android:color/transparent</item>
    </style>

0 个答案:

没有答案