开发者

Scaling a WebView with Property Animations

开发者 https://www.devze.com 2023-03-20 07:24 出处:网络
I\'m working on a Honeycomb tablet app that needs to scale some UI views as the user interacts with it. So far I\'ve been using Property Animations and it\'s working pretty well with ImageViews and Te

I'm working on a Honeycomb tablet app that needs to scale some UI views as the user interacts with it. So far I've been using Property Animations and it's working pretty well with ImageViews and TextViews but behaves strangely with a WebView.

webView.animate().scaleX(2).setDuration(400);

This code behaves exactly as I want with ImageView and TextView. It smoothly zooms the UI up to double its original size (in this case only in the X direction).

With a WebView it will scale the view to double its original size, but the viewport remains stationary. If I throw a translationX animation in there that doesn't affect the position of the viewport either. How can I get the WebView's contents to scale along with the view?

UPDATE: It turns out that the code I entered here works perfectly in开发者_StackOverflow社区 the Android 3.1 emulator. The strange behavior I'm seeing only happens on the actual device. The device I have is a Verizon Motorola Xoom with Android 3.1. I unfortunately don't have any other devices to test it on so I don't know if it's model specific or just a quirk in the release build of the code.


I'm starting to think this is an Android or Xoom bug. On this forum thread u can see the whole discussion.

In my case I animate().translationX(value) the frameLayout that contains the webView but the webView fails to draw it's content in the new position.

Myself and some people from the forum ran it on an advent vega running VegaComb 3.2 all of them getting the same bug. On the other hand running on several emulators with different screen sizes and pixel densities or an Asus Transformer it behaves the way it should.

0

精彩评论

暂无评论...
验证码 换一张
取 消