【发布时间】:2016-09-28 06:13:37
【问题描述】:
我正在创建一个 Android 程序。在这个程序中,我有一个 ScrollView,里面有一个 RecyclerView。我通过 RecyclerViewAdapter 在这个 RecyclerView 中添加数据。
对于 RecyclerView 的每个项目,都有一个 NestedScrollview,它具有一个垂直方向的 LinearLayout。我在此 LinearLayout 中动态添加 ImageView。
问题是图像没有滚动。在非常罕见的情况下(通过在屏幕上点击这么多次),它会滚动一次。
有人可以帮我解决这个问题吗?
这里是代码-
父回收者视图:-
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<android.support.v7.widget.RecyclerView
android:id="@+id/id_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@color/gray3"
android:dividerHeight="5sp"
android:paddingLeft="2sp"
android:paddingTop="5sp"
android:paddingRight="2sp"/>
<com.app.sh.widget.WrappedGridView
android:id="@+id/gridView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/White"
android:numColumns="2">
</com.app.socialhand.widget.WrappedGridView>
</LinearLayout>
</ScrollView>
以及回收站视图的项目:-
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/vScrollView"
android:layout_below="@id/iv_up"
android:layout_above="@+id/iv_down"
android:isScrollContainer="true"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/ll_123"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</LinearLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
我在 ll_123 中动态添加 ImageView。
【问题讨论】:
标签: android android-recyclerview