Answer the question
In order to leave comments, you need to log in
setAnimation + setVisibility not working on Android 4?
Animation animation= AnimationUtils.loadAnimation(this, R.anim.bottom_in);
animation.setDuration(200);
buttonsBar.setAnimation(animation);
buttonsBar.setVisibility(View.VISIBLE);
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="300"
android:fromYDelta="100%p"
android:toYDelta="0%p" />
</set>
Answer the question
In order to leave comments, you need to log in
Maybe it's worth setting Animation.AnimationListener in animation and moving buttonsBar.setVisibility(View.VISIBLE); in onAnimationEnd?
Judging by the animation XML file, you are changing the Y-axis size from 100% to 0% with respect to the parent buttonsBar. That is, in the animation you hide the buttonsBar, and in the properties you set the visibility. Here it seems to be visible to you, but hidden by animation.
Good afternoon!
Try like this:
buttonsBar.setVisibility(View.VISIBLE);
buttonsBar.startAnimation(this,AnimationUtils.loadAnimation(R.anim.bottom_in));
if(needAnimate)
view.startAnimation(context,AnimationUtils.loadAnimation(R.anim.download_animation));
else
view.clearAnimation();
<rotate
android:fillAfter="true"
android:fromDegrees="0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:pivotX="0.5"
android:pivotY="0.5"
android:toDegrees="180" />
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question