我正在尝试仅在加载时显示加载文本。 问题是我将它设置为可见并且在完成加载后看不见。但是文本永远不会有更新的机会。有没有办法强制刷新屏幕,或者有另一种方法可以做到这一点? 感谢
这是我的代码
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();
}
});
答案 0 :(得分:2)
您需要在单独的线程中执行实际加载。你最好使用AsyncTask。看看http://www.vogella.com/articles/AndroidPerformance/article.html