티스토리 뷰

Android/UI

TextClock

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



 

TextClock 은 TextView 를 상속받고 있는 간단한 디지털 시계이다.

단, 시간은 설정할 수 없으므로 시간을 설정해야 한다면 TimePicker 를 써야한다.



How to

◼ TextColck code in XML

 

◼ TextClock code in JAVA



Attributes

◼ id

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



◼ format12Hour

12 시간 모드(시스템 시간 설정) 에서 보여줄 형식 설정

 



◼ format24Hour

24 시간 모드(시스템 시간 설정) 에서 보여줄 형식 설정

 



◼ gravity

Text(TextClock 시간) 를 정렬할 수 있는 속성이다.

 - layout_width, layout_height 이 wrap_content 이면 text 가 정렬될 공간이 없어 정렬이 안된다.

 - gravity 를 지정하지 않으면 기본 속성인 left, top 이 적용된다.

[Android/Layout] - TextView gravity (TextView gravity 와 동일하다.)

 

 



◼ textColor

Text(timer 시간) 의 색상을 설정한다.

- “#argb”, “#rgb”, “#rrggbb”, or “#aarrggbb” 형태로 지정할 수 있다.

 



◼ textSize

Text(timer 시간) 의 크기를 설정한다.

- sp(scale independent pixel) or dp(density pixel) 로 설정 할 수 있다.

 



◼ textStyle

Text 의 style 을 설정한다.

- "bold"(굵게), "italic"(이태릭), "normal"(기본) 을 설정할 수 있고 "|" 로 2개 이상의 설정을 할 수 있다.

 



◼ background

TextClock 의 배경색을 설정한다.

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

 

◼ padding

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

 

 



728x90

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

MultiAutoCompleteTextView  (0) 2019.08.27
AutoCompleteTextView  (0) 2019.08.27
Chronometer  (0) 2019.08.27
CheckedTextView  (0) 2019.08.27
SeekBar  (0) 2019.08.27
댓글