开发者

ViewFlipper animations and minSdkVersion

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 开发者_如何学Cbehavior. 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


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜