Android NumberPicker 사용
사용 버전: Android Studio 4.0.1
사용 언어: Kotlin 1.4.10
NumberPicker는 사용자가 정해진 범위의 숫자를 선택할 때 제공되면 편리하게 선택할 수 있게 도와줍니다.
사용 언어: Kotlin 1.4.10
안드로이드 NumberPicker 사용을 해봅시다.
NumberPicker는 사용자가 정해진 범위의 숫자를 선택할 때 제공되면 편리하게 선택할 수 있게 도와줍니다.

binding을 사용합니다.
자, 오늘은 Snooze Intervals를 누르면 NumberPicker가 나오게 만들어 봅시다.

res - layout에 NumberPicker를 위한 layout을 추가합니다.

저는 interval_number_picker.xml로 만들었습니다.

아래처럼 NumberPicker를 추가합니다.


이제, fragment.kt 파일로 갑니다.
Dialog를 부를 함수를 만듭니다.
저는 callNumberPickerDialog로 만들었습니다.

위의 함수에 NumberPicker 최솟값, 최댓값을 넣어줍니다.

그리고 Positive, Negetive 버튼을 추가합니다.

onCreateView로 돌아와서 버튼에 함수를 추가합니다.

실행해봅시다.

짜잔.
끝.
카테고리: Android

[계수기] 앱 광고
외국: Hand Counter
계수기 앱.
하나씩 개수를 셀 때 사용해보세요.
센 숫자를 메모와 함께 저장할 수 있습니다.
감사합니다.
[계수기] 앱 광고 끝.
댓글
댓글 쓰기
궁금한 점은 댓글 달아주세요.
Comment if you have any questions.