簡體   English   中英

如何在recyclerview(RecyclerView.Adapter)中刪除邊框?

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

我正在嘗試首次創建消息應用,並且我在recyclerview創建的邊界處堆疊。 所以有人可以知道如何從recyclerview中刪除它

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

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

嘗試設定

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM