i make the following view.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:fitsSystemWindows="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_gravity="center|right"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="@{() -> viewActions.openMore()}"
android:src="@drawable/btn_my_more" />
</LinearLayout>
<ScrollView
android:id="@+id/layout_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:id="@+id/layout_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/layout_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="55dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="visible">
<ImageView
android:id="@+id/iv_profile_thumbnail"
android:layout_width="90dp"
android:layout_height="90dp"
android:background="@drawable/shape_my_profile_thumbnail"
android:scaleType="fitCenter"
app:profileThumbnailSrc="@{myProfile.profileUrl}" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@{myProfile.urlId}"
android:textColor="@color/black"
android:textSize="23dp"
android:textStyle="bold" />
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager_my"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/gnb_height" />
</LinearLayout>
</ScrollView>
</LinearLayout>
The viewpager has two fragment with recyclerview.
when ia recyclerview in a viewpager scroll up, how to scroll the top ScrollView. in current, only recyclervie in a viewpager is scrolled.
if you know how to solve, please answer my question. thank you very much
I am not sure if this will solve your problem or not because of the lack of your code information but, please try this and let me know if this resolves your issue.
recyclerView.setHasFixedSize(true);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext(),LinearLayoutManager.VERTICAL, false);
layoutManager.setAutoMeasureEnabled(true);
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setLayoutManager(layoutManager);
use below to stop Parent getting any event.
recyclerView.requestDisallowInterceptTouchEvent(true)
set it to false when you want parent to Intercept event's of child.
if you want to stop scrolling in recycler is a special case :
override fun onTouchEvent(event: MotionEvent?): Boolean {
//special case condition
if(x==y&& event.action== MotionEvent.ACTION_DOWN){
return false
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.