Himanshu Mori Himanshu Mori - 4 months ago 57
Android Question

How to create circular list view of items in android?

I want to create a view where items view will be in circular round. Here i am sharing my image to describe my requirement.

The number of items will be dynamic.

circular items

Can anyone suggest library for this kind of stuff?

RRR RRR
Answer

You need to check this library : WheelView

add dependency to your build.gradle

dependencies {
   compile 'com.github.lukedeighton:wheelview:0.3.1'
}

add custom view to your xml

<com.lukedeighton.wheelview.WheelView
    android:id="@+id/wheelview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:wheelColor="@color/grey_400"
    app:rotatableWheelDrawable="false"
    app:selectionAngle="90.0"
    app:wheelPosition="bottom"
    app:wheelOffsetY="60dp"
    app:repeatItems="true"
    app:wheelRadius="276dp"
    app:wheelItemCount="14"
    app:wheelPadding="13dp"
    app:wheelItemRadius="43dp"/>

set adapter in java code

wheelView.setAdapter(new WheelAdapter() {
    @Override
    public Drawable getDrawable(int position) {
        //return drawable here - the position can be seen in the gifs above
    }

    @Override
    public int getCount() {
        //return the count
    }
});

enter image description here