AndroidSwipeLayout icon indicating copy to clipboard operation
AndroidSwipeLayout copied to clipboard

Listview Swipe Not working with Pull To Refresh On Fragment

Open suman-cribello opened this issue 8 years ago • 4 comments

I using your code .


<android.support.v4.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/SwipeRefreshLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ListView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+idlist_swipe"
            />
    </RelativeLayout>

</android.support.v4.widget.SwipeRefreshLayout>

If i add SwipeRefreshLayout then Your Listview Swipe Functionality is not working .

May I know what is the correct way to achieve my objective? Any help would be greatly appreciated.

suman-cribello avatar Apr 06 '16 06:04 suman-cribello

@daimajia This functionality working on Activity section but Problem in Fragment section . Did't work on Fragment section . Waiting for your early reply .

suman-cribello avatar Apr 08 '16 14:04 suman-cribello

@Amiyo-cribello Im using swipelayout and SwipeRefreshLayout, its work well. Show ur code/layout

ivanovd422 avatar Apr 18 '16 19:04 ivanovd422

I face the same problem in fragment

 <android.support.v4.widget.SwipeRefreshLayout

        android:id="@+id/portfolio_swipe_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ScrollView
            android:id="@+id/portfolio_scrollview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <RelativeLayout
                    android:id="@+id/portfolio_layout_add_export"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_marginTop="20dp">

                    <ImageView
                        android:id="@+id/portfolio_img_add"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginRight="10dp"
                        android:src="@drawable/add_button"
                        android:text="@string/btn_add" />

                    <ImageView
                        android:id="@+id/portfolio_img_export"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_toRightOf="@+id/portfolio_img_add"
                        android:src="@drawable/export_button"
                        android:text="@string/btn_add"
                        android:visibility="gone" />

                </RelativeLayout>

                <RelativeLayout
                    android:id="@+id/portfolio_layout_hold_title"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/portfolio_layout_add_export"
                    android:layout_marginTop="20dp"
                    android:paddingBottom="5dp"
                    android:paddingTop="5dp"
                    android:visibility="visible">

                    <com.idealratings.presentation.utils.textviews.OpenSansBold
                        android:id="@+id/portfolio_txt_holding"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:text="@string/holding"
                        android:textColor="@color/orange" />

                    <com.idealratings.presentation.utils.textviews.OpenSansRegular
                        android:id="@+id/portfolio_txt_portfolioDetails"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:background="@drawable/blue_bg"
                        android:padding="10dp"
                        android:text="@string/portfolio_details"
                        android:textColor="@color/blue_grey" />


                </RelativeLayout>


                <android.support.v7.widget.CardView
                    android:id="@+id/portfolio_card_view_portfolio"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/portfolio_layout_hold_title"
                    android:layout_marginTop="10dp"

                    android:descendantFocusability="blocksDescendants"
                    android:orientation="vertical"
                    card_view:cardUseCompatPadding="true">

                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/portfolio_recycler_view_portfolio"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:background="@color/blue_sky"
                        android:scrollbars="none" />

                </android.support.v7.widget.CardView>

                <LinearLayout
                    android:id="@+id/ll"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/portfolio_card_view_portfolio"
                    android:layout_marginTop="10dp"
                    android:gravity="center_horizontal"
                    android:orientation="horizontal">

                    <com.idealratings.presentation.utils.textviews.OpenSansRegular
                        android:id="@+id/portfolio_txt_calculate"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginRight="10dp"
                        android:background="@drawable/rounded_corner_orange"
                        android:padding="10dp"
                        android:text="@string/calculate_purification"
                        android:textColor="@color/white" />


                </LinearLayout>

                <RelativeLayout
                    android:id="@+id/portfolio_layout_wishlist_title"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/ll"
                    android:layout_marginTop="20dp"
                    android:paddingBottom="5dp"
                    android:paddingTop="5dp"
                    android:visibility="visible">

                    <com.idealratings.presentation.utils.textviews.OpenSansBold
                        android:id="@+id/portfolio_txt_wishlist"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:text="@string/watchlist"
                        android:textColor="@color/orange" />

                </RelativeLayout>

                <android.support.v7.widget.CardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/portfolio_layout_wishlist_title"
                    android:layout_marginTop="10dp"
                    android:descendantFocusability="blocksDescendants"
                    android:orientation="vertical"
                    card_view:cardUseCompatPadding="true">

                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/portfolio_recycler_view_wishlist"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:background="@color/blue_sky"
                        android:scrollbars="none" />
                </android.support.v7.widget.CardView>

                <ProgressBar
                    android:id="@+id/portfolio_progress_bar"
                    style="?android:attr/progressBarStyleLarge"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/portfolio_layout_add_export"
                    android:layout_centerInParent="true"
                    android:layout_marginRight="5dp"
                    android:visibility="gone" />

                <com.idealratings.presentation.utils.textviews.OpenSansBold
                    android:id="@+id/portfolio_txt_please_login"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:text="@string/please_login"
                    android:textColor="@color/orange" />

            </RelativeLayout>
        </ScrollView>
    </android.support.v4.widget.SwipeRefreshLayout>

Here is the Code

swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                if (InternetConnectionChecker.getInstance().isNetworkAvailable(activity)) {
                   // do stuff
                }
            }
        });

AliAbozaid avatar Jun 18 '16 15:06 AliAbozaid

I faced the same problem too, it seems that we can't put ScrollView inside SwipeRefreshLayout !!

ahmedbr avatar Dec 18 '18 22:12 ahmedbr