您需要检查这个库:WheelView
将依赖项添加到您的build.gradle中。
dependencies {
compile 'com.github.lukedeighton:wheelview:0.3.1'
}
将自定义视图添加到您的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"/>
在Java代码中设置适配器
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
}
});