这里我有一个带动画的自定义TextView:
badge7 = new BadgeView(this,findViewById(R.id.action_contact));
badge7.hide();
badge7.setTextColor(Color.BLUE);
badge7.setBadgeBackgroundColor(Color.YELLOW);
text++;
badge7.setText(String.valueOf(text));
badge7.setTextSize(12);
badge7.setBackgroundResource(R.drawable.badge_ifaux);
badge7.setBadgePosition(BadgeView.POSITION_TOP_LEFT);
badge7.setBadgeMargin(15, 10);
TranslateAnimation anim = new TranslateAnimation(-100, 0, 0, 0);
anim.setInterpolator(new BounceInterpolator());
anim.setDuration(2000);
anim.cancel();
badge7.toggle(anim, null);
问题是每当再次播放动画时,我需要从屏幕上移除最后一个,但是我无法实现它,这样做的正确方法是什么?
答案 0 :(得分:0)
if(badge7!=null){
badge7.setVisibility(View.GONE);
badge7.invalidate();
}