티스토리 뷰

TextClock 은 TextView 를 상속받고 있는 간단한 디지털 시계이다.
단, 시간은 설정할 수 없으므로 시간을 설정해야 한다면 TimePicker 를 써야한다.
How to
◼ TextColck code in XML
<TextClock | |
android:id="@+id/simple_textclock" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" /> |
◼ TextClock code in JAVA
TextClock textClock = (TextClock) findViewById(R.id.simple_textclock); | |
boolean is24HourModeEnabled = textClock.is24HourModeEnabled(); |
Attributes
◼ id
id 는 해당 TextClock 을 유일하게 식별할 수 있는 속성이다.
<TextClock | |
android:id="@+id/simple_textclock | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" /> |
◼ format12Hour
12 시간 모드(시스템 시간 설정) 에서 보여줄 형식 설정
<TextClock | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:format12Hour="hh:mm:ss a" /> |

◼ format24Hour
24 시간 모드(시스템 시간 설정) 에서 보여줄 형식 설정
<TextClock | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:format24Hour="HH:mm:ss" /> |

◼ gravity
Text(TextClock 시간) 를 정렬할 수 있는 속성이다.
- layout_width, layout_height 이 wrap_content 이면 text 가 정렬될 공간이 없어 정렬이 안된다.
- gravity 를 지정하지 않으면 기본 속성인 left, top 이 적용된다.
[Android/Layout] - TextView gravity (TextView gravity 와 동일하다.)
<TextClock | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:gravity="center" /> |

◼ textColor
Text(timer 시간) 의 색상을 설정한다.
- “#argb”, “#rgb”, “#rrggbb”, or “#aarrggbb” 형태로 지정할 수 있다.
<TextClock | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:textColor="#0000FF" /> |

◼ textSize
Text(timer 시간) 의 크기를 설정한다.
- sp(scale independent pixel) or dp(density pixel) 로 설정 할 수 있다.
<TextClock | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:textSize="30.00sp" /> |

◼ textStyle
Text 의 style 을 설정한다.
- "bold"(굵게), "italic"(이태릭), "normal"(기본) 을 설정할 수 있고 "|" 로 2개 이상의 설정을 할 수 있다.
<TextClock | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:textStyle="bold | italic" /> |

◼ background
TextClock 의 배경색을 설정한다.
- color 값이나 drawable 을 설정할 수 있다.
◼ padding
TextClock 의 왼쪽, 오른쪽, 위, 아래 padding 을 설정한다.
<TextClock | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:background="#00FF00" | |
android:padding="15.00dp" /> |

'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 |
- Total
- Today
- Yesterday
- 앱테크
- task
- mPANDO
- 앱테크 추천
- notifyDataSetChanged
- 리워드앱
- Intent
- onCreateContextMenu
- onContextItemSelected
- StartService
- bindservice
- 리워드 어플
- android activity flag
- RoomDatabase
- 안드로이드 인텐트
- android flag activity
- registerForContextMenu
- WEMIX
- BroadcastReceiver
- StringUtils
- 무료 채굴
- task 생성
- android intent
- android task
- M2E
- Android Service
- 무료채굴
- 안드로이드 서비스
- 채굴앱
- p2e
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |