【发布时间】:2018-12-18 06:46:19
【问题描述】:
我提出以下观点。
<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>
viewpager 有两个带有 recyclerview 的片段。
当我在 viewpager 中的 recyclerview 向上滚动时,如何滚动顶部的 ScrollView。 目前,只有 viewpager 中的 recyclervie 会被滚动。
如果你知道如何解决,请回答我的问题。 非常感谢
【问题讨论】:
-
试试 NestedScrollView
-
您能否详细解释一下您到底想达到什么目标?
-
@Moinkhan 谢谢你的回答,但我应用了 NestedScrollView,但它不起作用
-
在 nestedScrollView 中应用一些属性,如 fillViewPort、NestedScrollingEnable ...
-
@RudrikPatel 一个viewpager 有两个fragment,每个fraghemt 都有一个recyclerview,当我recyclerview 滚动时,父scrollview 不滚动,只有recycerview 滚动
标签: android scroll android-recyclerview android-viewpager