i using new material design libraries:
compile 'com.android.support:design:22.2.0' compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.android.support:recyclerview-v7:22.2.0' and have typical simple layout (3 tabs) in cheesquareapp

here each tab fragment simple recyclerview
layout - fragment_cheese_list.xml
<android.support.v7.widget.recyclerview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="match_parent" /> and works great. change layout fragment_cheese_list.xml have other items. such example.
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical"> <progressbar android:id="@+id/progress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:indeterminate="true" android:visibility="gone"/> <linearlayout android:id="@+id/empty_list_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="no results, tap button search again"/> <button android:id="@+id/btn_search" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="search"/> </linearlayout> <android.support.v7.widget.recyclerview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone"/> </linearlayout> as can see here, show recyclerview when there items, , if there no items, hide show button , text. switching visibilities (view.gone - view.visible).
i have of done already, problem when recyclerview not visible, cannot "scroll" layout hide/show toolbar last image in picture

so brings lot of problems, if switch 1 tab one, while having toolbar hidden, cannot show toolbar again, unless switch tabs , scroll show it.
thanks
edit: maybe there way programatically code when viewpager changes, hide/show animation toolbar. although not best solution workaround, if knows please post how code (tried code did not work)
you need wrap button & label nestedscrollview.
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" > <progressbar android:id="@+id/progress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:indeterminate="true" android:visibility="gone" /> <android.support.v4.widget.nestedscrollview android:id="@+id/nested_scroll_view" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true" > <linearlayout android:id="@+id/empty_list_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="no results, tap button search again" /> <button android:id="@+id/btn_search" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="search" /> </linearlayout> </android.support.v4.widget.nestedscrollview> <android.support.v7.widget.recyclerview android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" /> </linearlayout>
Comments
Post a Comment