Himanshu Mori
Himanshu Mori

Reputation: 873

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?

Upvotes: 3

Views: 3764

Answers (1)

Ravi
Ravi

Reputation: 35549

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

Upvotes: 2

Related Questions