簡體   English   中英

工具欄在CoordinatorLayout中向下滾動

[英]Toolbar scrolls down in CoordinatorLayout

我在使用CoordinatorLayout滾動時遇到問題,請參閱gif。

看到驚人的gif

我認為問題是使用帶有工具欄頂部的translucentStatus,我該如何解決? 我已經嘗試過使用自定義ScrollingViewBehavior,但是它不起作用:(

我在這里先向您的幫助表示感謝

<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/coordinatorLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clipToPadding="false"
            android:elevation="5dp"
            android:minHeight="?attr/actionBarSize"
            android:paddingTop="24dp" />

        <com.astuetz.PagerSlidingTabStrip
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/white"
            app:pstsShouldExpand="true" />

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

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

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

<im.tox.toktok.app.view.widgets.ScrimInsetsFrameLayout
    android:layout_width="300dp"
    android:layout_height="match_parent"
    android:layout_gravity="left|start"
    android:fitsSystemWindows="true"
    app:insetForeground="#4000">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="?android:attr/windowBackground">

        <View
            android:id="@+id/drawer_accent_color"
            android:layout_width="match_parent"
            android:layout_height="250dp"
            android:elevation="2dp" />

        <android.support.v7.widget.CardView
            android:layout_width="250dp"
            android:layout_height="250dp"
            android:layout_alignBottom="@id/drawer_accent_color"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="-48dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:orientation="vertical">

                <de.hdodenhof.circleimageview.CircleImageView
                    android:id="@+id/drawer_user_logo"
                    android:layout_width="120dp"
                    android:layout_height="120dp"
                    android:layout_gravity="center"
                    android:src="@color/light_grey" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="@dimen/spacing_normal"
                    android:text="André Almeida"
                    android:textColor="@color/dark_grey"
                    android:textSize="@dimen/font_larger" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:text="This is a sample message that crosses…"
                    android:textColor="@color/light_grey"
                    android:textSize="@dimen/font_small" />

            </LinearLayout>

        </android.support.v7.widget.CardView>

    </RelativeLayout>

</im.tox.toktok.app.view.widgets.ScrimInsetsFrameLayout></android.support.v4.widget.DrawerLayout>

您應該添加:

機器人:fitsSystemWindows = “真”

到您的CoordinatorLayout。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM