-
-
Notifications
You must be signed in to change notification settings - Fork 547
WIKI
Aige edited this page Dec 30, 2025
·
3 revisions
Notice: This document applies to WheelPicker v1.2.0+. Please migrate to the latest version for Jetpack Compose support and Kotlin optimizations.
WheelPicker is now published on Maven Central with a new Group ID.
implementation("dev.aige.pub:WheelPicker:1.2.0")implementation 'dev.aige.pub:WheelPicker:1.2.0'<dependency>
<groupId>dev.aige.pub</groupId>
<artifactId>WheelPicker</artifactId>
<version>1.2.0</version>
<type>pom</type>
</dependency>WheelPicker now provides native support for Jetpack Compose.
import com.aigestudio.wheelpicker.compose.WheelPicker
@Composable
fun WheelPickerExample() {
// 1. Prepare data
val data = (1..100).map { "Item $it" }
// 2. Use the Composable
WheelPicker(
data = data,
modifier = Modifier.size(100.dp, 200.dp),
selectedItemPosition = 5,
visibleItemCount = 7,
itemTextSize = 18.sp,
itemTextColor = Color.Gray,
selectedItemTextColor = Color.Black,
onItemSelected = { index, item ->
println("Selected: $item at index $index")
}
)
}-
wheel_data: Reference to a string array resource. -
wheel_selected_item_position: Index of the initially selected item. -
wheel_item_text_size: Size of the item text. -
wheel_item_text_color: Color of unselected items. -
wheel_selected_item_text_color: Color of the selected item. -
wheel_same_width: Whether all items should have the same width. -
wheel_maximum_width_text: Text used to calculate the maximum width. -
wheel_visible_item_count: Number of visible items (must be odd). -
wheel_item_space: Vertical space between items. -
wheel_cyclic: Whether the data repeats cyclically. -
wheel_indicator: Show/hide the selection indicator. -
wheel_indicator_color: Color of the indicator. -
wheel_indicator_size: Thickness of the indicator lines. -
wheel_curtain: Show/hide the central curtain/highlight. -
wheel_curtain_color: Color of the curtain. -
wheel_atmospheric: Enable atmospheric effect (transparency fade). -
wheel_curved: Enable 3D curved effect. -
wheel_item_align: Alignment of items (center, left, right).
<com.aigestudio.wheelpicker.WheelPicker
android:id="@+id/wheelPicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:wheel_visible_item_count="7"
app:wheel_curved="true" />Kotlin:
val wheelPicker = findViewById<WheelPicker>(R.id.wheelPicker)
wheelPicker.data = listOf("A", "B", "C", "D")
wheelPicker.setOnItemSelectedListener { picker, data, position ->
println("Selected: $data")
}Java:
WheelPicker wheelPicker = findViewById(R.id.wheelPicker);
List<String> data = new ArrayList<>();
data.add("A");
data.add("B");
wheelPicker.setData(data);
wheelPicker.setOnItemSelectedListener(new WheelPicker.OnItemSelectedListener() {
@Override
public void onItemSelected(WheelPicker picker, Object data, int position) {
System.out.println("Selected: " + data);
}
});For v1.2.0, getters and setters have been converted to Kotlin Properties where possible, but Java getters/setters remain fully supported.
-
data/setData(List) -
selectedItemPosition/setSelectedItemPosition(int) -
visibleItemCount/setVisibleItemCount(int) -
isCyclic/setCyclic(boolean) -
indicator/setIndicator(boolean) -
curtain/setCurtain(boolean) -
atmospheric/setAtmospheric(boolean) -
curved/setCurved(boolean) -
itemAlign/setItemAlign(int) -
typeface/setTypeface(Typeface) - ...and more.
See IWheelPicker.kt for the full API documentation.
You have two ways to get the selected item:
-
Listener (Recommended): Use
setOnItemSelectedListener. It triggers only when the scroll stops. -
Direct Access: Use
getCurrentItemPosition()orgetData(). Note: Calling this while scrolling returns the last stable position.
WheelPicker includes ready-to-use widgets for common scenarios:
-
WheelDatePicker(Date selection) WheelYearPickerWheelMonthPickerWheelDayPicker-
WheelAreaPicker(Chinese administrative regions)
<com.aigestudio.wheelpicker.widgets.WheelDatePicker
android:layout_width="wrap_content"
android:layout_height="wrap_content" />