【问题标题】:Animation not working on marker click(Only 1st click)动画在标记单击时不起作用(仅第一次单击)
【发布时间】:2017-07-13 18:19:16
【问题描述】:

当我第一次单击标记时,视图突然出现在屏幕上,然后我再次单击标记,视图出现在淡入动画中。 动画不仅适用于第一次标记点击。

    @Override
    public boolean onMarkerClick(Marker marker) {

            final Animation animationFadeIn = AnimationUtils.loadAnimation(getContext(), R.anim.fadein);
            animationFadeIn.setAnimationListener(new Animation.AnimationListener() {
                @Override
                public void onAnimationStart(Animation animation) {
                    Log.d(TAG, "animation start");
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    Log.d(TAG, "animation end");
                    profile_details.setVisibility(View.VISIBLE);

                }

                @Override
                public void onAnimationRepeat(Animation animation) {

                }
            });
            profile_details.startAnimation(animationFadeIn);

            return true;
        }

【问题讨论】:

  • profile_details 视图的初始可见性消失了吗?
  • 我有另一个按钮可以将可见性设置为 GONE,是的,初始可见性已 GONE
  • 然后将 profile_details.setVisibilty(VISIBLE) 移到 onAnimationStart() 中,如果它在动画开始时闪烁,则在 onAnimationStart 中设置Alpha=0
  • setAlpha to 0 不起作用,但在 onAnimationStartWorked 中添加 setVisible(View.Visible),你能写答案,这样我就可以将其标记为正确。谢谢大佬
  • 已经完成。 :)

标签: android android-animation marker


【解决方案1】:

只需在 onAnimationStart() 中移动 profile_details.setVisibilty(VISIBLE)。

【讨论】:

    猜你喜欢
    • 2012-07-09
    • 2021-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-23
    相关资源
    最近更新 更多