Created
November 20, 2011 06:37
-
-
Save yujikosuga/1379893 to your computer and use it in GitHub Desktop.
Android resize animation with no Animation class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Decrease the padding top size. */ | |
int update_interval_millis = 25; | |
int decrease_size_per_interval = 10; | |
int toSize = 100; | |
View view; | |
final Handler handler = new Handler(); | |
Runnable runnable = new Runnable() { | |
@Override | |
public void run() { | |
view.setPadding( | |
view.getPaddingLeft(), | |
view.getPaddingTop() - decrease_size_per_interval, | |
view.getPaddingRight(), | |
view.getPaddingBottom()); | |
if (toSize < view.getPaddingTop()) { | |
handler.postDelayed(this, update_interval_millis); | |
} else { | |
/* Fix a small gap at last. */ | |
view.setPadding( | |
mRefreshView.getPaddingLeft(), | |
toSize, | |
view.getPaddingRight(), | |
view.getPaddingBottom()); | |
} | |
} | |
}; | |
handler.postDelayed(runnable, update_interval_millis); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment