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

时间:2018-01-18 14:08:18

标签: android android-layout android-recyclerview

我正在尝试第一次创建消息应用程序,我正在此边框堆栈 由recyclerview创建。那么有人可以知道如何从recyclerview中删除它

recyclerview (RecyclerView.Adapter) UPDATE:

<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

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

1 个答案:

答案 0 :(得分:0)

尝试设置

recylerview.addItemDecoration(null);

或者

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