一、Activity中
TranslateAnimation ta = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, -1.0f,
Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, 0);
ta.setDuration(500);
view.startAnimation(ta);
new DelayExecuter() {
@Override
public void doInUiThread() {
// 通知更新主界面
lockedAdapter.notifyDataSetChanged();
}
}.delayExectue(500); //延迟0.5秒后才去通知
--------------------------------------------------------------------------------------------------
或者
TranslateAnimation ta = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, -1.0f,
Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, 0);
ta.setDuration(500);
view.startAnimation(ta);
new Handler().postDelayed(new Runnable(){
@Override
public void run(){
//通知更新主界面
xxx.notifyDataSetChanged();
}
},500);