View.post(Runnable) ;View.postDelay(Runnable , long)

View.post(Runnable) 

mTextView.post(new Runnable() {
    @Override
    public void run() {
        mTextView.setText("yes, 获取到数据了!#");
        mTextView.setBackgroundColor(Color.BLUE);
    }
});


View.postDelay(Runnable , long)

Android View 都有一个postDelayed(Runnable,毫秒数),用于延迟UI操作的方法,下面的代码中就是300毫秒之后,calendar_view才显示

private void method() {
    blur_view.setBackgroundColor(Color.BLACK);
    blur_view.postDelayed(new Runnable() {
        public void run() {
            calendar_view.setVisibility(View.GONE);
            CalendarActivity.this.finish();
        }
    }, 300);
}





你可能感兴趣的:(View.post(Runnable) ;View.postDelay(Runnable , long))