I have an activity consisting of a toolbar and a presentation pager. Its location is as follows:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="112dp" android:layout_gravity="bottom" tools:context=".Rhino68PanelActivity" /> <LinearLayout android:id="@+id/toolbarContainer" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <include android:id="@+id/app_bar" layout="@layout/app_bar" /> <include android:id="@+id/tap_strip" layout="@layout/tab_strip" /> </LinearLayout>
Then I load two fragments into the presentation pager. Each fragment contains its own SwipeRefreshLayout . I will show one fragment layout:
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/swipe_refresh_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightSum="12" tools:context=".Rhino68PanelActivity$DummySectionFragment"> ... <android.support.v7.widget.RecyclerView android:id="@+id/recyclerView_panel_status" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipToPadding="false" /> </LinearLayout>
Now when I run the action, it works. However, I noticed that this is horizontal (i.e. go to the next tab). It launches SwipeRefreshLayout OnRefreshListener
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mSwipeRefreshLayout.setRefreshing(true); DoUpdate(); } });
I also experience odd visual behavior when I try to make an update. The loading sign (twisting circle) is often not displayed, and it sometimes shows, but remains small. I'm not sure if this also causes the two views to conflict with each other.
Is there any way to solve this problem. I am not sure how to do this. Perhaps limiting SwipeRefreshLayout to only listen to vertical scrolls?
Any suggestions would be greatly appreciated.
source share