Move a view with TranslateAnimation (percentage)

view story

http://stackoverflow.com – I have a view that hides/shows when the user press a button. It's working fine, but now I want it moves from the position the user has left the view to its default position (using TranslateAnimation). See the example below: float percent = (float) (((releasePos - minPos) / (maxPos - minPos)) * (-1)); releasePos: it's the position (x), when the user stops touching. minPos: it's the minimum position that the view can go (x). maxPos: the maximum position (x). The percent variable can be between -1.0 and 0 (-1.0 is the minimum x and 0 is the maximum). For example: if the view maximum position (HowTos)