-1
我有一個背景圖像(image1在我的可繪製文件夾中)。我想在我的android應用程序中創建一個擁有此背景圖片的頁面,並在兩秒鐘後在其中間寫入一個文本「歡迎」。請幫我編碼。背景圖像依文字出現2秒
這是我的佈局背景。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/image1">
相關的Java。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.background);
Thread timer = new Thread(){
public void run(){
try {
sleep(2000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
finally{
}
}
};
timer.start();
}
@Override
protected void onPause() {
super.onPause();
finish();
}
}
我想了解我應該在上面最後括號內寫什麼,以使文本「歡迎」在2秒後出現。我應該提到歡迎作爲我的背景佈局中的文本視圖。
我已經加入我試圖把代碼添加一個TextView – Sohit