-2

Say I have a view,and I want to move it upward using setTranslationY method.

View view = findViewById(R.id.mView);
view.setTranslationY(-10.0f);

The view is indeed moved upwards,but I find it still occupies the original position.How could I move the view permanently to its final position.Also I found a similar solution but does not work.Android translate animation - permanently move View to new position using AnimationListener

Community
  • 1
  • 1
tounaobun
  • 14,570
  • 9
  • 53
  • 75

2 Answers2

1

Use and modify the LayoutParams instead.

mach
  • 8,315
  • 3
  • 33
  • 51
0

You can use a library called NineOldAndroids for using the Honeycomb animation API on all versions of the platform back to 1.0! (http://nineoldandroids.com)

Try this...

ViewHelper.setTranslationX(view, 50f);

Only You have use the static methods in the ViewHelper class and pass the view object and the value you want to set it to.

mInE.....
  • 143
  • 11