Here is my layout xml.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/garae_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/background"
android:fillViewport="true"
android:focusableInTouchMode="false" >
<RelativeLayout>
...
<com.handmark.pulltorefresh.library.PullToRefreshScrollView>
<LinearLayout/>
</com.handmark.pulltorefresh.library.PullToRefreshScrollView>
</RelativeLayout>
</ScrollView>
I already tried the solution in this link: ScrollView Inside ScrollView
However, it didn't work. How can do use child PullToRefreshScrollView?? Please help me.
android:fillViewport. Defines whether the scrollview should stretch its content to fill the viewport.
Attributes Of Scroll View: ScrollView and HorizontalScrollView has same attributes, the only difference is scrollView scroll the child items in vertical direction while horizontal scroll view scroll the child items in horizontal direction.
Horizontal ScrollView is a FrameLayout, used to provide the child View element horizontal scrolling property. The ChildView in itself can be a layout manager like the linear layout. The TextView class takes care of its own scrolling, But it can be placed inside a HorizontalScrollView to create more complex UI designs.
If I understand your question, you want to implement a Pull to refresh in your Scrollview. Instead, to use the library you are using, I would suggest you to implement a SwipeRefreshLayout https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html It is a layout that implements a pull-to-refresh like in the application of Google+ or Gmail.
Here's an example implementing SwipeRefreshLayout
in your xml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:layout_width="match_parent" android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android" >
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/garae_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>
NOTE
It is highly not recommended to put a Scrollview/Listview inside a Scrollview/Listview. The first reason is about the performance and Romain Guy explains that in one video https://www.youtube.com/watch?v=wDBM6wVEO70
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With