在nestedscrollview或recyclerview删除后,CoordinatorLayout不会滚动

时间:2018-02-12 14:10:15

标签: android android-layout android-coordinatorlayout android-nestedscrollview

切换标签时,我隐藏(view.removeAllViews()或INVISIBLE或GONE)旧标签的内容并显示新标签的内容。 每个选项卡的内容(@ + id /容器)包含Nestedscrollview或Recyclerview。

  1. 当您打开表单时,一切正常。
  2. 切换后,触摸时表单滚动不起作用 AppBarLayout
  3. 滚动浏览Nestedscrollview或Recyclerview后,滚动浏览 AppBarLayout开始工作。
  4. 我把它放在CoordinatorLayout中:

      

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/margin_list_items"
        android:background="@drawable/product_detail_background"
        android:fitsSystemWindows="true"
        app:theme="@style/ProductDetailsAppBar">
    
        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/product_detail_background"
            android:fitsSystemWindows="true"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:scrimAnimationDuration="100">
    
            <LinearLayout
                android:id="@+id/ll_app_bar_content"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/dim_8"
                android:layout_marginTop="?attr/actionBarSize"
                android:orientation="vertical"
                app:layout_collapseMode="none">
    
                ...
    
            </LinearLayout>
    
            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:layout_gravity="top"
                android:scrollbarFadeDuration="100"
                app:layout_collapseMode="pin">
    
               ...
    
            </android.support.v7.widget.Toolbar>
    
        </android.support.design.widget.CollapsingToolbarLayout>
    
        <android.support.design.widget.TabLayout
            android:id="@+id/tl_product"
            style="@style/TabLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/margin_list_items">
    
           ...
    
        </android.support.design.widget.TabLayout>
    
    </android.support.design.widget.AppBarLayout>
    
    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
    
    <com.github.clans.fab.FloatingActionMenu
        android:id="@+id/fab_menu"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="bottom|end"
        android:padding="@dimen/margin_fab"
        app:menu_backgroundColor="@color/fab_transparent_background"
        app:menu_colorNormal="@color/main_green"
        app:menu_colorPressed="@color/main_green"
        app:menu_icon="@drawable/ic_add">
    
        ...
    
    </com.github.clans.fab.FloatingActionMenu>
    
         

0 个答案:

没有答案