Who provides the best performances for Android : XML or Java ?
For example the animation. I can obtain the same result with both Java and XML, using two differents way :
• Java
private Animation outToRightAnimation() {
Animation outToRight = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, +1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
outToRight.setDuration(500);
outToRight.setInterpolator(new DecelerateInterpolator());
return outToRight;
}
• XML
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://ift.tt/nIICcg"
android:fillAfter="true"
android:interpolator="@android:anim/decelerate_interpolator" >
<translate
android:duration="500"
android:fillAfter="true"
android:fromXDelta="0%p"
android:toXDelta="100%p" />
</set>
Which one is supposed to be faster ? Which one should I use ?
No comments:
Post a Comment