I have an view which has an DrawableAnimation background in the layout, I get the animation drawable and start animation or stop animation like below code
private void init() {
xxx.setBackgroundResource(R.drawable.avatar_wave_profile);
mAnimationDrawable = (AnimationDrawable)mAvatarWave.getBackground();
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
if (hasFocus) {
mAnimationDrawable.start();
} else {
mAnimationDrawable.stop();
}
}
But when i touch the layout or the layout is moving(in an sliding menu), it will flicker. so how to avoid this problem, any advice will be appreciated.