I was playing with the new RecyclerView
. and ran into a few issues:
android:background="?android:attr/selectableItemBackground"
(RecyclerView onItemClick effect in L)How can I make the RecyclerView behave more like the ListView when being clicked such that the user is able to see the click animation complete before the click listener is notified?
I understand that I can simply fix this, by using View.postDelayed
, but this doesn't seem like the best solution, because during the delay, the user may be able to click on more list items.
Below is a link to a repository of an android studio project that has a ListView
and RecyclerView
side by side to help demonstrate the issue: https://github.com/ericytsang/question.listview-vs-recyclerview
Thanks a lot!
I had the same issue. I was working with fragments and replacing the fragments when a list item is clicked, but the click animation doesn't show up. So, I replaced the fragment code with the code to start another Activity, and that solved my problem. You said the animation is not complete before the click listener goes to even another "activity or something", but for me works.
Insted of this
NewFragment newFragment = NewFragment.newInstance();
FragmentTransaction ft = (getFragmentManager()).beginTransaction();
ft.replace(R.id.fragment_container, newFragment);
ft.addToBackStack(null);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
I use this
Intent transitionIntent = new Intent(getActivity(), DetailActivity.class);
startActivity(transitionIntent);
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