Android-ScalingActivityAnimator

Additional

Language
Java
Version
N/A
Created
Aug 21, 2015
Updated
Apr 4, 2017 (Retired)
Owner
zhengxiaoyong (Sunzxyong)
Contributor
zhengxiaoyong (Sunzxyong)
1
Activity
Badge
Generate
Download
Source code

Android-ScalingActivityAnimator

An interesting pop-view Animation,This is a popWindow pop-up, activity shrink animation


Effect

Uasge

You can use this to display the default effect.

You must pass the current activity layout id and the pop-view view id

  ScalingActivityAnimator mScalingActivityAnimator = new ScalingActivityAnimator(this, this, R.id.root_view, R.layout.pop_view);
  mScalingActivityAnimator.start();

If you want to get the pop-view child controls, so you can use

  ScalingActivityAnimator mScalingActivityAnimator = new ScalingActivityAnimator(this, this, R.id.root_view, R.layout.pop_view);
  View popView = mScalingActivityAnimator.start();
  Button mButtonBack = (Button) popView.findViewById(R.id.btn_cancel);
  mButtonBack.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mScalingActivityAnimator.resume();
        }
  });
  

Exit Animation

  mScalingActivityAnimator.resume();

You can also set the size of the pop-view

  mScalingActivityAnimator.setPopViewHeightIsTwoThirdOfScreen();

Setting styles and adding animation xml file

Add animation xml file in anim directory,and setting styles

  <style name="showScalingAnimation" parent="android:Animation">
        <item name="android:windowEnterAnimation">@anim/show_popup_in</item>
        <item name="android:windowExitAnimation">@anim/show_popup_out</item>
  </style>