• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Swiperefresh also working on left swipe

Furian

Lurker
i have a listview in a fragment(Total 3 tabs in viewpager) and using this below code to get swipe down to refresh functionality but on swiping left to another fragment swipe refresh function is called how to restrict this(happens only if listview is empty).

Code:
<RelativeLayout 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.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragmenttab1_swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fragmenttab1_list_item"
android:dividerHeight="1dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:longClickable="true">
</ListView>
</android.support.v4.widget.SwipeRefreshLayout>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/fragmenttab1_emptyElement"
android:text="No Posts"
android:textStyle="bold"
android:textSize="15sp"
android:visibility="gone"
android:layout_centerInParent="true"
android:textColor="@android:color/darker_gray"/>

</RelativeLayout>
Java code

Code:
listView.setAdapter(adapter);

listView.setEmptyView(getView().findViewById(R.id.fragmenttab1_emptyElement));
 
Last edited:
Welcome to AndroidForums. To make your code easier to read for the folks that may be able to help you should add code tags.
Example:

[code]
line 1...
line 2...
line etc...
[/code]


Code:
line 1...
line 2...
line etc...
 
Back
Top Bottom