1

The resolution of my device is 1080*1920 (portrait), and the size of my webview is 1080*960

I use TranslateAnimation on WebView to translate it from y=0 to y=960.

TranslateAnimation animation = new TranslateAnimation(0f, 0f, 0f, 960f);
animation.setDuration(300);
animation.setFillAfter(true);

webview.startAnimation(animation);

Android help me to draw the webview to y=960, but I cannot trigger any touch event in the y range [960, 1920], instead, my touch event is triggered in the y range [0, 960].

It seems some control component or other things didn't be translated to y=960 with the webview.

Is there any method to translate the control also to y=960, or other better solution is recommended?

Many thanks.

azizbekian
  • 60,783
  • 13
  • 169
  • 249
Nestarneal
  • 205
  • 1
  • 2
  • 12

1 Answers1

2

TranslateAnimation animates the matrix, not the View itself. So, you end up seeing an illusion: you see a View which in fact has other coordinates.

Either you need to change WebView coordinates after animation ends, or you can use fluent API instead of TranslateAnimation:

webview.animate()
       .y(960f)
       .setDuration(300);
azizbekian
  • 60,783
  • 13
  • 169
  • 249
  • Thank you for your response. Also, the thread [What is the difference between an Animator and an Animation?](http://stackoverflow.com/questions/28220613/what-is-the-difference-between-an-animator-and-an-animation) is helpful to me, too. – Nestarneal Apr 20 '17 at 02:50