Android CoordinatorLayout and SwipeRefreshLayout and RecyclerView

Here is my code:

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

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

                <android.support.v7.widget.Toolbar
                    android:id="@+id/tool_bar"
                    android:layout_width="match_parent"
                    android:layout_height="100dp"
                    android:background="@android:color/white"
                    android:orientation="vertical"
                    app:layout_scrollFlags="scroll|enterAlways"/>

                <android.support.design.widget.TabLayout
                    android:id="@+id/tablayout"
                    android:layout_width="match_parent"
                    android:layout_height="100dp"
                    android:background="#03BCD4"/>
            </android.support.design.widget.AppBarLayout>

            <android.support.v4.widget.SwipeRefreshLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_behavior="@string/appbar_scrolling_view_behavior">

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/recyclerview"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"/>
            </android.support.v4.widget.SwipeRefreshLayout>

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

      

If the RecyclerView

Adapter is getItemCount

too small RecyclerView

it cannot scroll and the toolbar is hidden.

It is difficult to display the toolbar as it always shows the update status SwipeRefreshLayout

.

Is there anything I can replace to fix the problem?

+3


source to share





All Articles