티스토리 뷰

Android/UI

SeekBar

parkho79 2019. 8. 27. 09:40
300x250
300x250



 

SeekBar 는 ProgressBar 를 상속받고 있으며 thumb(동그란 부분) 를 터치하여 좌우로 이동이 가능하다.

볼륨이나 밝기 조절 시 많이 쓰인다.



How to

◼ SeekBar code in XML

 

◼ SeekBar code in JAVA



Attributes

◼ id

id 는 해당 SeekBar 을 유일하게 식별할 수 있는 속성이다.



◼ progress & max

- progress : Progress 의 기본값 설정 (0 ~ MAX)

- max : Progress 의 최대값 설정

- Integer value 만 가능

 



◼ progressDrawable

SeekBar 배경과 프로그레스 를 custom 하게 설정할 수 있다.

 

[activity_main.xml]

 

[custom_progress.xml]

 



◼ indeterminate

작업량이 어느정도 인지 모를 경우 사용하며 진행률을 표시하지 않는다.

순환 에니메이션만 보인다.

 



◼ thumb

SeekBar 의 thumb(동그란 부분) 설정

 - 하단은 drawable 에 thumb image 가 있다는 가정이다.

 



◼ background

SeekBar 의 배경색을 설정한다.

- color 값이나 drawable 을 설정할 수 있다.

 



◼ padding

SeekBar 의 왼쪽, 오른쪽, 위, 아래 padding 을 설정한다.

 



Methods

◼ getMAX()

SeekBar 에 설정된 최대값 반환



◼ getProgress()

SeekBar 에 현재값 반환



728x90

'Android > UI' 카테고리의 다른 글

Chronometer  (0) 2019.08.27
CheckedTextView  (0) 2019.08.27
RatingBar  (0) 2019.08.27
ProgressBar  (0) 2019.08.27
ToggleButton (On/Off)  (0) 2019.08.22
댓글