[英]How to set Countdown Screen As Home Screen Wallpaper in Android.?
在我的應用程序中,我為剩余的幾天制作一個倒數屏幕(例如,倒數到聖誕節為止的日子),現在我想將該屏幕制作為主屏幕牆紙。
像這樣 :
如果您要在文本框中顯示時間,則也可以嘗試此代碼。
class UpdateTimeTask extends TimerTask {
public void run() {
long millis = System.currentTimeMillis() - startTime;
int seconds = (int) (millis / 1000);
int minutes = seconds / 60;
seconds = seconds % 60;
timeLabel.setText(String.format("%d:%02d", minutes, seconds));
}
}
http://developer.android.com/resources/articles/timed-ui-updates.html
嗨,如果您想要靜態背景圖片,則可以執行以下操作並將其放置在主應用程序的onCreate中:
// Set background image, rotatable
View view = getWindow().getDecorView();
int orientation = getResources().getConfiguration().orientation;
if (Configuration.ORIENTATION_LANDSCAPE == orientation) {
view.setBackgroundResource (R.drawable.yourimage); // Landscape
} else {
view.setBackgroundResource (R.drawable.yourimgae); // Portrait
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.