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

1

There are 1 answers

0
Hugo Gresse On

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