Scrollview Inside Viewpager, Scrolls To Middle Automatically
Solution 1:
This is likely caused by android:textIsSelectable. You may try adding the following to the ScrollView:
android:focusable="true"android:focusableInTouchMode="true"android:descendantFocusability="beforeDescendants"Solution 2:
Add this attribute value android:descendantFocusability="blocksDescendants" to the child of ScrollView, according to this question: How to prevent a scrollview from scrolling to a webview after data is loaded?
Solution 3:
I also had this problem. I solved it with setting android:focusable="true" and android:focusableInTouchMode="true" to the first element in the ScrollView's LinearLayout.
Solution 4:
i try to add
android:focusable="true"
android:focusableInTouchMode="true"
android:descendantFocusability="beforeDescendants"in the root viewGroup . it's work's well. like below.
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:layout_width="match_parent"android:layout_height="match_parent"android:focusable="true"android:focusableInTouchMode="true"android:descendantFocusability="beforeDescendants"android:background="@color/normal_bg"><ScrollViewandroid:id="@+id/scroll"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_above="@+id/rl_enter"android:scrollbars="none"></ScrollView></RelativeLayout>Solution 5:
I tried solution:
android:focusable=trueandroid:focusableInTouchMode=trueandroid:descendantFocusability=beforeDescendants
And i dont know why but I cant do this with my RelativeLayout which is parent view (this does not work).
I had to wrap my TextView inside FrameLayout and now everything is ok. Maybe this helps somebody.
<FrameLayoutandroid:id="@+id/detail_description_container"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_below="@id/detail_parameters_container"android:layout_centerInParent="true"android:descendantFocusability="beforeDescendants"android:focusable="true"android:focusableInTouchMode="true" ><TextViewandroid:id="@+id/detail_descritpion"android:layout_width="match_parent"android:layout_height="wrap_content"android:autoLink="all"android:padding="10dp"android:textIsSelectable="true" /></FrameLayout>
Post a Comment for "Scrollview Inside Viewpager, Scrolls To Middle Automatically"