【发布时间】:2018-02-17 13:34:04
【问题描述】:
首先我需要将NestedScrollView 滚动到顶部,但smoothScrollTo(0, 0) 对我不起作用(页面只是跳了一下)。其次,我想知道如何滚动到NestedScrollView 中的某个视图。 API 27,支持 27.0.2。
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<data/>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/PageBackground"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical"
android:paddingBottom="@dimen/indent_page_bottom">
...
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</layout>
【问题讨论】:
-
对其他人来说,这可能会有所帮助stackoverflow.com/questions/52083678/…
标签: android android-layout android-nestedscrollview