gpt4 book ai didi

android - 如何删除android中Recyclerview项目之间的分隔线

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:10:23 27 4
gpt4 key购买 nike

我想删除 RecyclerView 项目之间的分隔符(空格)

所以尝试将item view和RecyclerViewbackground设置为White,但是没有用如何解决?

项目 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>

Activity 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());

enter image description here

最佳答案

First define your RecyclerView :

RecyclerView recycle =(RecyclerView) findViewById(R.id.recyclerView);

and in your activity use this method:

recycle.addItemDecoration(new DividerItemDecoration(context, 0));

关于android - 如何删除android中Recyclerview项目之间的分隔线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34088536/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com