LoginSignup
2
0

More than 3 years have passed since last update.

【Android Studio】Number Pickerをループさせないようにする

Posted at

NumberPicker(ドラムロールUI)使用時に、ループさせないようにする方法。wrapSelectorWheelfalseにすればOKです。

1. レイアウト

activity_main.xml
<NumberPicker
    android:id="@+id/picker"
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"/>

2. 処理

MainActivity.kt
binding.picker.minValue = 0
binding.picker.maxValue = 5
binding.picker.wrapSelectorWheel = false
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0