我想要移除RecyclerView中item之间的分割线(空格)。
尝试将item view和RecyclerView的background
设置为White
,但并没有起作用。如何解决?
Item View的XML
代码:
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@android:color/white"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<LinearLayout
android:background="@android:color/white"
android:paddingLeft="@dimen/footer_item_padding"
android:paddingRight="@dimen/footer_item_padding"
android:orientation="vertical"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:id="@+id/img_avatar_category_item_adapter"
android:contentDescription="@string/app_name"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:layout_width="@dimen/image_width_category_adapter"
android:layout_height="wrap_content"/>
</LinearLayout>
</android.support.v7.widget.CardView>
活动XML:
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_categories_main_activity"
android:background="@android:color/white"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Activity
类:
rv_categories.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
rv_categories.setItemAnimator(new DefaultItemAnimator());