带有协调器布局的AppBar布局滚动隐藏了Android前棒棒糖版本底部的一些视图?

时间:2017-03-21 08:37:04

标签: android android-appbarlayout

我在底部使用了标签布局和协调器布局以及appbar布局,但它在棒棒糖前版本的底部显示了一些空白区域,但在上面的棒棒糖版本中工作正常。

Xml代码:

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:fitsSystemWindows="true"
    android:orientation="vertical">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBar"
        android:layout_width="match_parent"
        android:layout_height="72dp"
        android:fitsSystemWindows="true">

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

            <include layout="@layout/calendar_widget" />


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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/light_grey_color">

            <TextView
                android:id="@+id/text_view_selected_date"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginBottom="@dimen/margin_10dp"
                android:layout_marginLeft="@dimen/margin_16dp"
                android:layout_marginRight="@dimen/margin_16dp"
                android:layout_marginTop="@dimen/margin_10dp"
                android:background="@color/light_grey_color"
                android:fontFamily="@string/font_family_regular"
                android:gravity="center"
                android:lineSpacingExtra="8dp"
                android:textAppearance="@android:style/TextAppearance.Medium"
                android:textColor="@color/red_color" />
        </LinearLayout>

        <android.support.v4.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="fill_vertical"
            android:background="@android:color/white">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/text_size_16dp"
                android:layout_marginRight="@dimen/text_size_16dp"
                android:layout_marginTop="@dimen/margin_32dp"
                android:orientation="vertical">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="center">

                    <include layout="@layout/circular_chart" />

                </RelativeLayout>


                <RelativeLayout
                    android:id="@+id/relative_stress_progress_layout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/margin_32dp"
                    android:orientation="vertical">

                    <ImageView
                        android:id="@+id/image_stress"
                        android:layout_width="@dimen/image_size"
                        android:layout_height="@dimen/image_size"
                        android:src="@mipmap/icon_stress" />

                    <TextView
                        android:id="@+id/text_view_stress"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginLeft="@dimen/text_size_16dp"
                        android:layout_toRightOf="@+id/image_stress"
                        android:fontFamily="@string/font_family_regular"
                        android:text="@string/text_stress"
                        android:textSize="@dimen/text_size_16dp" />

                    <TextView
                        android:id="@+id/text_view_stress_value"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginLeft="@dimen/default_gap"
                        android:layout_marginTop="2dp"
                        android:layout_toRightOf="@+id/text_view_stress"
                        android:fontFamily="@string/font_family_regular"
                        android:gravity="center_vertical"
                        android:text="(0 Minutes)"
                        android:textSize="@dimen/text_size_16dp" />

                    <ProgressBar
                        android:id="@+id/progress_bar_stress"
                        style="@style/StressProgressFill"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/text_view_stress"
                        android:layout_marginLeft="@dimen/text_size_16dp"
                        android:layout_marginTop="@dimen/default_gap"
                        android:layout_toRightOf="@+id/image_stress" />

                </RelativeLayout>

                <RelativeLayout
                    android:id="@+id/relative_work_progress_layout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/margin_20dp"
                    android:orientation="vertical">

                    <ImageView
                        android:id="@+id/image_work"
                        android:layout_width="@dimen/image_size"
                        android:layout_height="@dimen/image_size"
                        android:src="@mipmap/icon_work_out" />

                    <TextView
                        android:id="@+id/text_view_work_out"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginLeft="@dimen/text_size_16dp"
                        android:layout_toRightOf="@+id/image_work"
                        android:fontFamily="@string/font_family_regular"
                        android:text="@string/text_work_out"
                        android:textSize="@dimen/text_size_16dp" />

                    <TextView
                        android:id="@+id/text_view_work_out_value"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginLeft="@dimen/default_gap"
                        android:layout_marginTop="2dp"
                        android:layout_toRightOf="@+id/text_view_work_out"
                        android:fontFamily="@string/font_family_regular"
                        android:text="(0 Minutes)"
                        android:textSize="@dimen/text_size_16dp" />

                    <ProgressBar
                        android:id="@+id/progress_bar_work_out"
                        style="@style/WorkoutProgress"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/text_view_work_out"
                        android:layout_marginLeft="@dimen/text_size_16dp"
                        android:layout_marginTop="@dimen/default_gap"
                        android:layout_toRightOf="@+id/image_work" />

                </RelativeLayout>

                <RelativeLayout
                    android:id="@+id/relative_sleep_progress_layout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/margin_20dp"
                    android:layout_marginTop="@dimen/margin_20dp"
                    android:orientation="vertical">

                    <ImageView
                        android:id="@+id/image_sleep"
                        android:layout_width="@dimen/image_size"
                        android:layout_height="@dimen/image_size"
                        android:src="@mipmap/icon_sleep" />

                    <TextView
                        android:id="@+id/text_view_sleep"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginLeft="@dimen/text_size_16dp"
                        android:layout_toRightOf="@+id/image_sleep"
                        android:fontFamily="@string/font_family_regular"
                        android:text="@string/text_sleep"
                        android:textSize="@dimen/text_size_16dp" />

                    <TextView
                        android:id="@+id/text_view_sleep_value"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginLeft="@dimen/default_gap"
                        android:layout_marginTop="2dp"
                        android:layout_toRightOf="@+id/text_view_sleep"
                        android:fontFamily="@string/font_family_regular"
                        android:text="(0 Minutes)"
                        android:textSize="@dimen/text_size_16dp" />

                    <ProgressBar
                        android:id="@+id/progress_bar_sleep"
                        style="@style/SleepProgress"
                        android:layout_width="270dp"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/text_view_sleep"
                        android:layout_marginLeft="@dimen/text_size_16dp"
                        android:layout_marginTop="@dimen/default_gap"
                        android:layout_toRightOf="@+id/image_sleep" />

                </RelativeLayout>

            </LinearLayout>
        </android.support.v4.widget.NestedScrollView>

    </LinearLayout>

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

Above lollipop screenshot

Pre lollipop version screenshot

0 个答案:

没有答案