ViewFlipper 动画和 minSdkVersion

发布于 2024-10-09 05:32:58 字数 1303 浏览 4 评论 0原文

昨天我向市场上传了一个应用程序,我必须将 uses-sdk android:minSdkVersion="4" 项添加到 Manifest 文件中。添加此项目后,我的 ViewFlipper 小部件出现了奇怪的行为。如果没有 minSdkVersion,视图 Flipper 使用动画没有问题,添加它后它会忽略它们,或者至少看起来没有使用动画。我还使用 minSdkVersion="8" 进行了测试,但遗憾的是它无助于让动画正常工作。还尝试添加两者:(uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"),相同的行为。从清单中删除 minSdkVersion 项目(本地测试)使 ViewFlipper 工作起来就像一个魅力。市场不允许我上传清单中没有 minSdkVersion 项目的 APK。

有人知道这是怎么回事吗?在我看来,这确实是一种奇怪的行为,它确实降低了应用程序的质量/用户体验。如果有人知道如何解决这个问题,请帮忙。

我如何使用脚蹼浏览内容的代码片段。

// call for the flipper to show the next item
flipper.setInAnimation(AnimationHelper.inFromLeftAnimation());
flipper.setOutAnimation(AnimationHelper.outToRightAnimation());
flipper.showNext();

// animation example method
public static Animation inFromRightAnimation() {
  Animation inFromRight = new TranslateAnimation(
  Animation.RELATIVE_TO_PARENT, +1.0f,
  Animation.RELATIVE_TO_PARENT, 0.0f,
  Animation.RELATIVE_TO_PARENT, 0.0f,
  Animation.RELATIVE_TO_PARENT, 0.0f);
  inFromRight.setDuration(150);
  inFromRight.setInterpolator(new AccelerateInterpolator());
  return inFromRight;
}

// XML: current Android manifest config for minSdkVersion
<uses-sdk android:minSdkVersion="4" 
 android:targetSdkVersion="8" 
/>

谢谢大家并致以最诚挚的问候, 米贾

yesterday I uploaded an application to the market and I had to add the uses-sdk android:minSdkVersion="4" Item to the Manifest file. After I add this item, I get a strange behavior from my ViewFlipper widget. Without the minSdkVersion the view Flipper is using animations without a problem, after adding it it ignores them or at least it seems that no animation is used. I also tested with minSdkVersion="8" but saddly it didin't help to get the animation working. Also tried adding both: (uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"), same behavior. Removing the minSdkVersion item from the manifes (local testing) makes the ViewFlipper work like a charm. Market does not let me upload an APK without minSdkVersion item in Manifest.

Does anybody know what this is all about? It's really a strange behavior in my opinion and it really lowers the quality / user experience of the app. Please help if somebody knows how to fix this.

Code snippen of how I use the flipper to flip through content.

// call for the flipper to show the next item
flipper.setInAnimation(AnimationHelper.inFromLeftAnimation());
flipper.setOutAnimation(AnimationHelper.outToRightAnimation());
flipper.showNext();

// animation example method
public static Animation inFromRightAnimation() {
  Animation inFromRight = new TranslateAnimation(
  Animation.RELATIVE_TO_PARENT, +1.0f,
  Animation.RELATIVE_TO_PARENT, 0.0f,
  Animation.RELATIVE_TO_PARENT, 0.0f,
  Animation.RELATIVE_TO_PARENT, 0.0f);
  inFromRight.setDuration(150);
  inFromRight.setInterpolator(new AccelerateInterpolator());
  return inFromRight;
}

// XML: current Android manifest config for minSdkVersion
<uses-sdk android:minSdkVersion="4" 
 android:targetSdkVersion="8" 
/>

Thank you all and best regards,
Mitja

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苏辞 2024-10-16 05:32:58

其实我也遇到过和你上面说的类似的问题。将 minSdkVersion 设置为 4 或以上时,每个动画的性能都会降低。基准日志表明,Animation.applyTransformation 和 Animation.getTransformation 之间的第一次时间间隔从 3-6ms 更改为 100-200ms,这就是重点,但我没有时间检查更多源代码来找出原因。现在,我使用的解决方案是将 minSdkVersion 设置为 3 或更低。糟糕的代码但可以工作,希望有用。

Actually I have met similar problem as what you say above. Performance of every animation will be cut down while setting minSdkVersion to 4 or above. And benchmark logs tell that first time interval between Animation.applyTransformation and Animation.getTransformation changes from 3-6ms to 100-200ms, that's the point, but I have no time to check more source code to find out why. Now, the solution I'm using is to set minSdkVersion to 3 or below. Bad code but works, hope useful.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文