The ripple effect does not occur when makeSceneTransitionAnimation is also used.

I have a rippleDrawable which I use as the background for 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 onClick layout activity. When I just do startActivity (), the ripple effect works fine - you can see that most of the ripple effect is happening, then a new screen is displayed.

However, if I start my activity with ActivityOptionsCompat.makeSceneTransitionAnimation, the ripple effect does not occur when I click on the layout. Note that a long press still shows ripple in this case.

I also tried this on the button and saw the same result.

So, it’s like makeSceneTransitionAnimation happens too fast or overrides the ripple effect. I would like the ripples to end, or at least some of them were visible before the scene transition animation. I'm not sure if this is due to ripple and transition competing with the rendering stream?

I tried calling postponeEnterTransition for the activity being called. But it didn’t work - the called activity still shows immediately, and then the transition is delayed until you start it again.

Anyone have any ideas on what I can do wrong?

I am using API 21 (no AppCompat). Thanks in advance for any help.

+6
source share
1 answer

Not sure if I answer your question 100%, but I had a problem that sounds similar to a ripple effect that does not end when a new action starts, so I ended up using a delayed handler in OnClickListener:

 Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { startActivity(intent); } }, 150); 
+4
source

Source: https://habr.com/ru/post/979400/


All Articles