android-animation
Using fade in animation for a view
Suppose you have an ImageView named imageView and an animation file your_fade_in_anim.xml inside your res\anim\ folder: ImageView imageView = (ImageView) findViewById(R.id.imageView); Animation fadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.your_fade_in_anim); // Now Set your animation imageView.startAnimation(fadeInAnimation); Your XML <?xml version=”1.0″ encoding=”UTF-8″?> <set xmlns:android=”http://schemas.android.com/apk/res/android”> <alpha android:fromAlpha=”0.0″ android:toAlpha=”1.0″ android:interpolator=”@android:anim/accelerate_interpolator” android:duration=”[duration (in milliseconds)]” android:repeatCount=”infinite” /> </set> Replace the brackets with your actual … Read more
Animate layout change of bottom sheet
Based on your description, I think you are trying to achieve something like google maps bottom sheet behaviour. The layout changes as the bottomsheet is dragged up. If that is what you are trying to achieve then you don’t need to enforce custom animations, as the bottomsheetdialog itself has those animation behaviour when incorporated inside … Read more
Blinking Text in android view
Actually there is an Easter egg blink tag for this in ICS! 🙂 I don’t actually recommend using it – was REALLY amused to find it in the source, though! <blink xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”wrap_content” android:layout_height=”wrap_content”> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”I’m blinking” /> </blink>
Android Animation: Wait until finished?
The easiest way would be to post a (delayed) Runnable to the UI thread: Animation fadeout = new AlphaAnimation(1.f, 0.f); fadeout.setDuration(500); view.startAnimation(fadeout); view.postDelayed(new Runnable() { @Override public void run() { view.setVisibility(View.GONE); } }, 500); That will do the job painlessly. And never (never, never, never!) try to block the UI thread in Android. If you … Read more
Android: How to make a nice heartbeat animation? [closed]
Android: How to make a nice heartbeat animation? [closed]
Android – zoom in/out RelativeLayout with spread/pinch
So I created a subclass of RelativeLayout as described in the above mentioned topics. It looks like this: public class ZoomableRelativeLayout extends RelativeLayout { float mScaleFactor = 1; float mPivotX; float mPivotY; public ZoomableRelativeLayout(Context context) { super(context); // TODO Auto-generated constructor stub } public ZoomableRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor … Read more
How to remove Black background between start new activity during slide_left animation?
Setting the Theme didn’t work for me, but adding an exit animation did. overridePendingTransition (R.anim.push_up_in,R.anim.hold); For the exit animation, I just used an animation that does nothing. <?xml version=”1.0″ encoding=”utf-8″?> <set xmlns:android=”http://schemas.android.com/apk/res/android”> <translate android:fromYDelta=”0%p” android:toYDelta=”0%p” android:duration=”2000″/> </set>
Feature discovery animations for Android
You need to make custom animation or else you can use Ripple Effect + Reveal and set it to navigation drawer icon, Circular Reveal Animation void enterReveal() { // previously invisible view final View myView = findViewById(R.id.my_view); // get the center for the clipping circle int cx = myView.getMeasuredWidth() / 2; int cy = myView.getMeasuredHeight() … Read more
Shared element activity transition on android 5
I encounter the same issue, and notice the crash happens if the original shared element is no longer visible on the previous screen when you go back (probably it is the last element on screen in portrait, but once switched to landscape it’s no longer visible), and thus the transition has nowhere to put back … Read more