scrollview - Scroll PullToRefreshScrollview automatically in android -


i have listview, framelayout inside pulltorefreshscrollview. , i'm loading fragment framelayout. data loading listview using lazy adapter. i'm able see fragment/framelayout while listview loading. scrollview automatically scrolling postion of listview after data loaded listview , framelayout not visible. how can scroll scrollview top? please me. 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/listview"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:background="@color/app_bg"             android:focusable="false"  />          <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> 

here aproach took

lets have reference pulltorefreshscrollview so

pulltorefreshscrollview myrefreshscrollview = (pulltorefreshscrollview)findviewbyid(r.id. ptrscrollview); 

to actual scrollview object need call getrefreshableview() so

scrollview myscrollview =  myrefreshscrollview.getrefreshableview(); 

and scroll object

myscrollview.scrollto(0,0); 

or

myscrollview.smoothscrollto(0,0) 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -