[英]Android - Display the loading text
我試圖只在加載時顯示加載文本。 問題是我將它設置為可見並且在完成加載后看不見。 但是文本永遠不會有更新的機會。 有沒有辦法強制刷新屏幕,或者有另一種方法可以做到這一點? 謝謝
這是我的代碼
SearchBtn = (Button) findViewById(R.id.SearchButton);
SearchBtn.setOnClickListener(new OnClickListener()
{
public void onClick(View arg0)
{
//this is never seen because its set straight after to invisible
LoadingText.setVisibility(View.VISIBLE);
SearchFor(EditSearchField.getText().toString()); // all loading done here
LoadingText.setVisibility(View.INVISIBLE);
HideKeyboard();
}
});
您需要在單獨的線程中執行實際加載。 你最好使用AsyncTask。 請查看http://www.vogella.com/articles/AndroidPerformance/article.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.