I have a rippleDrawable that I'm using as the background for a LinearLayout:
<LinearLayout
android:id="@+id/card_layout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:clickable="true"
android:background="@drawable/ripple"
android:orientation="vertical" >
I want to start a new activity onClick of the layout. When I just do a startActivity(), the ripple effect works fine - you can see most of the ripple effect occur, then the new screen is shown.
However, if I start the activity using ActivityOptionsCompat.makeSceneTransitionAnimation, the ripple effect does not occur when I tap the layout. Note, long pressing does still show the ripple in this case.
I have tried this on a button as well and saw the same result.
So it's like makeSceneTransitionAnimation is happening too quickly, or overriding the ripple effect. I would like the ripple to finish or at least have some of it be seen before the scene transition animation occurs. I'm not sure if this has to do with the ripple and transition competing over the render thread?
I tried calling postponeEnterTransition on the called activity. But this didn't work - the called activity still immediately shows, and then the transition is postponed until you start it again.
Anyone have any ideas on what I could be doing wrong?
I'm using API 21 (no AppCompat). Thanks in advance for any help.
Not 100% sure I am answering your question but I had an issue which sounds similar with the ripple effect not finishing when I start a new activity, so I ended up using a handler with a delay in the OnClickListener:
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
startActivity(intent);
}
}, 150);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With