List of usage examples for android.widget TextClock TextClock
@SuppressWarnings("UnusedDeclaration") public TextClock(Context context)
From source file:nz.al4.airclock.AirClockFragment.java
private View setupClock() { // add digital clock textClock = new TextClock(getContext()); textClock.setId(textClockId);/*from w w w .j a va2 s. co m*/ textClock.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT)); textClock.setTypeface(textClock.getTypeface(), Typeface.BOLD); textClock.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 48); textClock.setGravity(Gravity.CENTER_HORIZONTAL); return textClock; }
From source file:nz.al4.airclock.AirClockFragment.java
private View setupDate() { // add digital date textDate = new TextClock(getContext()); textDate.setId(textDateId);/*from w w w .j a v a 2 s . co m*/ RelativeLayout.LayoutParams textDateParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); textDateParams.addRule(RelativeLayout.BELOW, textClockId); textDate.setLayoutParams(textDateParams); textDate.setTypeface(textDate.getTypeface(), Typeface.BOLD); textDate.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); textDate.setGravity(Gravity.CENTER_HORIZONTAL); SpannableString dateSpan = new SpannableString("yyyy/MM/dd"); textDate.setFormat24Hour(dateSpan); textDate.setFormat12Hour(dateSpan); return textDate; }