in Education by
I want to expand/collapse the items of my recyclerView in order to show more info. I want to achieve the same effect of the SlideExpandableListView. Basically in my viewHolder I have a view that is not visible and I want to do a smooth expand/collapse animation rather than set the visibility to VISIBLE/GONE only. I only need an item to be expanded at a time and it would be cool to have some elevation to show that the item is selected. It is the same effect of the new Android recent calls history list. The options "CALL BACK" and "DETAILS" are visible only when an item is selected. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Please don't use any library for this effect instead use the recommended way of doing it according to Google I/O. In your recyclerView's onBindViewHolder method do this: final boolean isExpanded = position==mExpandedPosition; holder.details.setVisibility(isExpanded?View.VISIBLE:View.GONE); holder.itemView.setActivated(isExpanded); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mExpandedPosition = isExpanded ? -1:position; TransitionManager.beginDelayedTransition(recyclerView); notifyDataSetChanged(); } }); Where details is my view that will be displayed on touch (call details in your case. Default Visibility.GONE). mExpandedPosition is an int variable initialized to -1 And for the cool effects that you wanted, use these as your list_item attributes: android:background="@drawable/comment_background" android:stateListAnimator="@animator/comment_selection" where comment_background is: and comment_selection is:

Related questions

0 votes
    I am newbie to android development and learning it to my own. I have a very strange problem of ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    I am newbie to android development and learning it to my own. I have a very strange problem of ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 14, 2022 in Education by JackTerrance
0 votes
    What were the consequences of the collapse of the USSR? Select the correct answer from above options...
asked Aug 3, 2022 in Education by JackTerrance
0 votes
    When did the Soviet Union collapse? Would you say that the U.S Hegemony began after the collapse of the Soviet Union? Select the correct answer from above options...
asked Aug 3, 2022 in Education by JackTerrance
0 votes
    Here some snippet of my code. when first time RecyclerView create I have to used recyclerView.scrollToPosition( ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have started implementation of Glide in my existing project and have been going through docs and examples. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 22, 2022 in Education by JackTerrance
0 votes
    I have a Fragment inside of my MainActivity that contains a RecyclerView being populated by a RecyclerView.Adapter ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    a few days from now I am trying to write a selenium ide test for a data structure tree. I stuck ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    I cant figure out how to select the following: 123 -> 123.00000 123.12 -> 123.12000 123.123456 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    I cant figure out how to select the following: 123 -> 123.00000 123.12 -> 123.12000 123.123456 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    Can someone help with this: in a new df2 var2 should be added and df2$var1 should be expanded by df1$var2, filling new lines in Var1 & Var3 as given by variables in df1: (df1...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I found the following piece of code from the adw launcher: Object service = launcher.getSystemService("statusbar ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 13, 2022 in Education by JackTerrance
0 votes
    When I go to command mode and type :!mycommand % I get my command executed on the current file ( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 13, 2022 in Education by JackTerrance
0 votes
    Expand CBT_______ a) Computer Behaved Training b) Cognitive Behavioural Therapy c) Consolidated Batch of trainers d) ... Basic Training Select the correct answer from above options...
asked Nov 13, 2021 in Education by JackTerrance
0 votes
    NoSQL databases are designed to expand _________. 1. with increase of load 2. vertically 3. hardware wise 4. horizontally...
asked Sep 6, 2021 in Technology by JackTerrance
...