I am using the following translate animation to move an image vertically down onto the screen in my android app. However, currently it goes to a fixed position of 150. I would like this value to be dependent on the screen size. For example, I want the image to stop at 20% of the users screen length, starting from the top of the screen. How would I adjust the y delta value to accomodate this?
mScanner = (ImageView)findViewById(R.id.logo_img);
mAnimation = new TranslateAnimation(0, 0, -300, 150);
mAnimation.setDuration(2500);
mAnimation.setFillAfter(true);
//mAnimation.setRepeatCount(-1);
// mAnimation.setRepeatMode(Animation.RESTART);
mScanner.setAnimation(mAnimation);
mScanner.setVisibility(View.VISIBLE);