Android slide down animation

I have a toolbar aligned at the bottom and above it over a WebView that fill the remaining height. Now I want to slide the toolbar to hide it, and while it enlivens the height of the web view, it needs to expand. I tried using TranslateAnimation, but, unfortunately, it did not adjust the actual position on the toolbar, but only the content was moved. Here is what I tried:

<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="0%"
    android:toXDelta="0%"
    android:fromYDelta="0%"
    android:toYDelta="100%"
    android:duration="700"
    android:fillAfter="true" />

And the actual code:

final View v = findViewById(R.id.browseToolbar);
Animation animation = AnimationUtils.loadAnimation(someContext, R.anim.toolbar_hide);
v.startAnimation(animation);

How can i do this?

+5
source share
2 answers

I wrote some code to make real resizing animations. Take a look:

http://www.touchlab.co/blog/resize-animation/

, Android

https://docs.google.com/present/view?id=djqv5kb_187c62jvbf7

, , , . - "". Android . , , , , , USED , . Android- .

, , ViewGroup.OnHierarchyChangeListener. / , .

+1

Android, . , onAnimationEnd. .

 AnimationListener animListener = new AnimationListener() {
     @Override
     public void onAnimationStart(Animation arg0) {}            
     @Override
     public void onAnimationRepeat(Animation arg0) {}                   
     @Override
     public void onAnimationEnd(Animation arg0) {
        Move the view here          
     }
 };

 animation.setAnimationListener(animListener);
0

All Articles