Question Detail

In my View there is a line between every item's end by using  RecyclerView I don't want it. How can I remove divider line from the list?
Image result for divider recyclerview


Thread Reply

Anonymous

- 1 years ago

use DividerItemDecoration class and override its onDraw method to do nothing like so:

mRecyclerView.addItemDecoration(new DividerItemDecoration(mContext, LinearLayoutManager.VERTICAL) {
        @Override
        public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
            // Do not draw the divider
        }
    });

Anonymous

- 10 months ago

<ListView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/listview_ID"
        android:divider="@null"
        android:layout_marginTop="15dp" />

and your can do it Programically

 

ListView listview = (ListView) findViewById(R.id.listview_ID);
listview.setDivider(null);

Anonymous

- 10 months ago

<ListView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/listview_ID"
        android:divider="@null"
        android:layout_marginTop="15dp" />

and your can do it Programically

 

ListView listview = (ListView) findViewById(R.id.listview_ID);
listview.setDivider(null);