简体   繁体   English

如何在recyclerview(RecyclerView.Adapter)中删除边框?

[英]How to remove the border in recyclerview (RecyclerView.Adapter)?

I am trying to create message app for the first time and i am stack at this border created by recyclerview. 我正在尝试首次创建消息应用,并且我在recyclerview创建的边界处堆叠。 So can someone know how to remove this from recyclerview 所以有人可以知道如何从recyclerview中删除它

recyclerview (RecyclerView.Adapter) UPDATE: recyclerview(RecyclerView.Adapter)更新:

<android.support.v7.widget.RecyclerView
        android:id="@+id/chat_list"
        app:reverseLayout="true"
        android:background="@color/lightgray"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

RecyclerView XML RecyclerView XML

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="10dp">

    <LinearLayout
        android:id="@+id/message_single_layout"
        android:orientation="vertical"
        android:gravity="end"
        android:layout_toRightOf="@+id/message_profile_layout"
        android:layout_toEndOf="@+id/message_profile_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

            <TextView
                android:id="@+id/message_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/white_rounded_chat"
                android:gravity="start"
                android:padding="5dp"
                android:paddingLeft="12dp"
                android:paddingStart="12dp"
                android:paddingRight="12dp"
                android:paddingEnd="12dp"
                android:text="Message Text"
                android:textAlignment="textStart"
                android:textColor="@color/white"
                android:textSize="16sp" /> 

        <TextView
            android:id="@+id/time_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="00:00"
            android:padding="5dp"
            android:textSize="12sp" />

    </LinearLayout> 
</RelativeLayout>

Try to set 尝试设定

recylerview.addItemDecoration(null);

Or 要么

 RecyclerView.ItemDecoration decoration = new RecyclerView.ItemDecoration() {
        @Override
        public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
            super.onDraw(c, parent, state);
        //empty
        }
    };

    simpleListView.addItemDecoration(decoration);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM