查了一下AOSP的原始碼也的確有這東西, 它是一個躲在LayoutInflater的一個叫BlinkLayout的東西, 這樣一來就可以配合TextClock (API Level 17)來做一個閃爍的時鐘了
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<blink android:layout_width="wrap_content" | |
android:layout_height="wrap_content"> | |
<TextClock | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:id="@+id/textClock" | |
android:textSize="60sp" | |
android:textColor="#b3b5b5"/> | |
</blink> |
不過, 這樣, 是整個TextClock在閃, 而不是像一般數字鐘一樣是只有":"閃, 如果要做到只有":"在閃, 那只好把"時"跟"分"給拆開, 像這樣:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TextClock | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:id="@+id/textClock" | |
android:textSize="60sp" | |
android:textColor="#b3b5b5" | |
android:format24Hour="k"/> | |
<blink android:layout_width="wrap_content" | |
android:layout_height="wrap_content"> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:textAppearance="?android:attr/textAppearanceLarge" | |
android:text=":" | |
android:id="@+id/textView" | |
android:textSize="60sp" | |
android:textColor="#b3b5b5"/> | |
</blink> | |
<TextClock | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:id="@+id/textClock2" | |
android:textSize="60sp" | |
android:textColor="#b3b5b5" | |
android:format24Hour="mm"/> |
沒有留言:
張貼留言