【发布时间】:2019-01-27 14:10:58
【问题描述】:
我有一个长宽的背景图像,我想放在一个包含 8 个项目的 Recyclerview 后面(Recyclerview)。这只有使用我在下面编码的水平滚动视图才有可能,但是有没有办法不使用水平滚动视图并获得相同的结果?
<HorizontalScrollView
android:id="@+id/HSV"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/back"
android:paddingLeft="2.5dp"
android:paddingRight="2.5dp"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</HorizontalScrollView>
使用上面的代码,我得到了所需的输出,但是当我删除 HorizontalScrollView 时,图像在宽度上压缩并松散了它的形状,我希望在滚动 recyclerview 时图像滚动 那就是我想要的图片: ![in Background is the aforementioned image and this eight Item are in recycler view and I want as the items finishing the background image is finishing too. ]1
【问题讨论】:
-
给出你想要的链接或演示。那会很有帮助。
-
@Alok 附demo
-
我已经回答了您的问题,请查看并告诉我您的情况如何。 :)
标签: android android-studio android-recyclerview horizontalscrollview