在一個線程,當我收到東西從互聯網上我要通知用戶,我這樣做Android的看法不刷新
new Thread(new Runnable(...
...
Log.d("tag", "going to redraw");
findViewById(R.id.view).setVisibility(View.VISIBLE);
findViewById(R.id.view).refreshDrawableState(); // tried this
findViewById(R.id.view).invalidate(); // and this together and separately
).start();
我總是查看日誌,並有時看到顯示的視圖。我不知道發生了什麼
我試圖將findViewById
包含在runOnUIThread
中,但那也沒有完成這項工作。對此有任何提示?
你試過'postInvalidate()'而不是'invalidate()'嗎? – codeMagic
@codeMagic仍然不能正常工作 – Thomas
在此之前,您有'VISIBILITY'作爲'GONE'或'INVISIBLE'嗎? – codeMagic