0

How to resolve when providing Layout left margin programmatically to a View / Viewgroup (For Animation)

When View reaches, view's Y pos to screen width(For example 240), View got shrinked.

View's X position is still moving but Y position not moving(if it reaches view's Y pos to screen width) so the view was shrniked.

i tried with setting width for that view (i.e) getLayoutParams().width = width // screen width which is not working

Perumss
  • 137
  • 3
  • 15
  • Im using ValueAnimator for animation which gives a values between start and end position from that i will update the View's X position. i will drag a button so animation will perform (drag like right left look like Notification bar animation when open) – Perumss Jun 10 '15 at 07:47

1 Answers1

0

We can't use leftMargin as we will do in Web. The view is setted to match_parent, android try to keep all content viewable.

We have to use translation so. Here is an answer. Moreover, it's more flexible.

I've also used it in one app, see :
- my custom view
- my animator xml
- java code

Community
  • 1
  • 1
Hugo Gresse
  • 17,195
  • 9
  • 77
  • 119