Siva Natarajan
Siva Natarajan

Reputation: 1429

Set Divider height in TwoWayView Android Library

I'm using http://lucasr.org/2013/02/21/introducing-twowayview/ Library for Horizontal Scroll View.

I need to set divider height between the items.

<org.lucasr.twowayview.TwoWayView
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/scroller_attached_images"
            style="@style/TwoWayView"
            android:layout_width="fill_parent"
            android:layout_height="200dp"
            android:layout_below="@id/editMessage"
            android:drawSelectorOnTop="false"
            android:focusable="false"
            tools:context=".MainActivity" 
            android:divider="@android:color/transparent"
            android:dividerHeight="10.0sp"/>

This doesnt work. Can anyone please help me ?

Regards, Siva

Upvotes: 2

Views: 1453

Answers (2)

Asaf Pinhassi
Asaf Pinhassi

Reputation: 15573

From the sample project:

final Drawable divider = getResources().getDrawable(R.drawable.divider);
mRecyclerView.addItemDecoration(new DividerItemDecoration(divider));

Where drawables/divider.xml is:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <solid android:color="#cccccc"/>
    <size android:width="2dp"
          android:height="2dp" />

</shape>

Upvotes: 0

Beaker
Beaker

Reputation: 1608

Perhaps this is too late now, but you can do this in code using setItemMargin:

TwoWayView listView = (TwoWayView) findViewById(R.id.scroller_attached_images);
listView.setItemMargin(10);

Upvotes: 6

Related Questions