我在我的应用程序中使用了HorizontalScrollView,并且经常改变其可见性(VISIBLE和GONE)。因此,我想做的是,不要突然使它可见和不可见,我能否应用某种动画或其他东西,以便它开始以滑动方式变得可见和不可见?任何帮助或建议将不胜感激。谢谢!
Animation animation = new TranslateAnimation(0,0,0,1000);
animation.setDuration(1000);
yourButtonorImage.startAnimation(animation);
要使其可见或不可见,您可以使用setAnimationListener。在onAnimationEnd中,将其设为可见或不可见。不确定这是否是您所要求的...希望能帮到您。
youView.setVisibility(View.VISIBLE);
ObjectAnimator anim = ObjectAnimator.ofFloat(youView, "alpha", 0f, 1f);
anim.setDuration(1000);
anim.start();
应用了 API 级别限制。