我是一位PHP開發人員,他是Android開發人員和Java的新成員,請耐心等待。每3秒更新一次TextView值
我正在爲測試和學習目的開發一個非常簡單的應用程序。
當用戶點擊我的應用程序圖標時,它們會顯示一個加載屏幕。我有一個TextView,下面有一個進度條。
TextView的XML代碼:
<TextView
android:id="@+id/loadingMessage1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/progressBar1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="22dp"
android:text="@string/loading1" />
的值設置爲字符串loading1中的strings.xml
<string name="loading1">Loading Message 1</string>
在我loadingscreen.java我有:
package com.example.myfirstapp;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;
public class LoadingScreen extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loading_screen);
TextView loadingMessage1 = (TextView)this.findViewById(R.id.loadingMessage1);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_loading_screen, menu);
return true;
}
}
公告我有代碼:
TextView loadingMessage1 =(TextView)this.findViewById(R.id.loadingMessage1);
我認爲這引用了文本視圖。
我想要發生的事情是每3秒出現一條不同的消息。
所以加載消息1 ...(3秒)加載消息2 ...(3秒)加載消息3 ..
後加載消息3我想一個按鈕來替換進度條。