android - Jumping to the top of the page with Gridview -
i using framelayout inside scrollview. on runtime, inserting framelayout fragment, it's layout gridview inside swiperefreshlayout.
the nested scrolling working good, problem when im trying on scrollview 1 of followings :
fullscroll(scrollview.focus_up)
or smoothscrollto(0,0)
or scrollto(0,0)
nothing happends, , gridview not top of page. (by way, getting scrollview
using findviewbyid
)
here code:
in main_theme.xml layout:
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_theme_scroll_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:fillviewport="true" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:orientation="vertical"> <framelayout android:name="com.example.ohad.myapplication.homeactivity" android:layout_margintop="?android:attr/actionbarsize" android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="wrap_content"/> </scrollview>
and in home_page.xml layout (the layout of fragment load framelayout):
<android.support.v4.widget.swiperefreshlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/home_swipe_refresh_layout" android:layout_width="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_height="match_parent"> <gridview android:id="@+id/homepage_gv" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/darkgray" android:gravity="center" android:horizontalspacing="0dp" android:numcolumns="1" android:nestedscrollingenabled="true" android:paddingleft="0dp" android:paddingtop="0dp" android:verticalspacing="1dp" /></android.support.v4.widget.swiperefreshlayout>
Comments
Post a Comment