Android ObjectAnimator not moving second view when one view is moved by animation

146 views Asked by At
<LinearLayout>
  <Checkbox>
  <Textview>
  <Imageview>
</LinearLayout>

In my Linearlayout with horizontal orientation, When I animate checkbox slide in from left to right using ObjectAnimator, both textview and imageview remains in same position, and the checkbox space is empty. It should behave like textview should be in left most position and move frame by frame to right when slide in animation of checkbox is undergoing.

  ObjectAnimator transAnimation= ObjectAnimator.ofFloat(holder.chk_select, "x", -100, 20);
        transAnimation.setDuration(200);
        transAnimation.start();
        transAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                holder.itemView.requestLayout();
            }
        });

The above code is what I'm using for animation. I read ObjectAnimator actually changes the real position of a view (here checkbox), so I thought the views (textbox and imageview) next to the checkbox also moves based on animation. Someone please confirm that what I'm expecting is possible or not or I have to animate all the three views for the expected result.

0

There are 0 answers