【发布时间】:2019-07-15 04:28:04
【问题描述】:
我使用 recyclerView 进行水平图像滚动。在适配器中,我已经提到仅对 ImageView 和 TextView 实现 recyclerView。
然后在 XML 中,我添加了一些额外的 ImageViews 来制作回收站视图的图像 SHARED、DOWNLOADED。
但是,所有额外的 imageView 也随着回收器视图滚动。我想让他们保持稳定。这让我很沮丧。
请帮帮我,我是初学者
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<ImageView
android:id="@+id/imageView"
android:src="@drawable/ic_launcher_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/toolbar_bottom"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
<TextView
android:id="@+id/word"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:ignore="MissingConstraints" />
<!--These 2 imageView are not listed in recyclerView but is still scrolling with recycler view. -->
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_navigate_next_black_24dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_others_black"/>
我尝试在 XML 中添加 include,但应用程序崩溃:(
【问题讨论】:
-
请添加代码和xml
-
@bugfreerammohan 我添加了。请帮帮我
-
@Rajana 你的 recyclerview 布局和项目布局在哪里
-
@ManojPerumarath 在 recyclerView 布局中我给了 id 和 width 是 mathparent 和 height 是 wrapparent。我不了解项目(可能是上面的)布局?
标签: java android android-studio android-recyclerview imageview