Amazon Gift Cards

Tuesday, April 20, 2010

Change View Position in Android

After a long silence, im back with a new Android post, a problem i encounter recently. So you have a view, you want to change the location of the view how can you do that?

There are a lot of ways in dealing with this, you could use SurfaceView and add some Views on top of it, or if you think its hard to deal with SurfaceView then here is a solution.

This solution might not be the best solution but it does work, and it works if you if still need to cater the first batch of android phones that comes with 1.5,1.6.

yourView.layout(left,top,left+width (right), top+height(bottom)

I used in a custom view with animation where setFillAfter is not working properly, so i have to come out with a solution on where the last frame of the animation is the layout(l,t,r,b) new position.

Post a Comment