Thursday, 8 August 2013

Scroll PullToRefreshScrollview automatically in android

Scroll PullToRefreshScrollview automatically in android

I have a Listview, FrameLayout inside PullToRefreshScrollview. And I'm
loading a fragment into framelayout. Data is loading into listview using
lazy adapter. I'm able to see the fragment/framelayout while listview is
loading. But Scrollview is automatically scrolling to the postion of
listview after data is loaded into listview and framelayout is not
visible. How can I scroll the scrollview to top? Please help me. Thanks in
advance
<?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:background="@color/app_bg"
android:orientation="vertical" >
<com.handmark.pulltorefresh.library.PullToRefreshScrollView
xmlns:ptr="http://schemas.android.com/apk/res-auto"
android:id="@+id/ptrScrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:paddingBottom="5dp"
ptr:ptrMode="pullUpFromBottom" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</FrameLayout>
<com.xxxx.yyyy.CustomListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/grid_view_eachsect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/app_bg"
android:clipChildren="true"
android:focusable="false"
android:numColumns="1"
android:paddingLeft="0dp"
android:stretchMode="columnWidth" />
<ProgressBar
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone" />
</LinearLayout>
</com.handmark.pulltorefresh.library.PullToRefreshScrollView>
</LinearLayout>

No comments:

Post a Comment