material-ripple icon indicating copy to clipboard operation
material-ripple copied to clipboard

the effect on cardview show behind it

Open Abdelsattar opened this issue 8 years ago • 7 comments

when i add it as parent and try it it just show the effect in the border of the card view behind it not the card view itself

Abdelsattar avatar Oct 21 '16 12:10 Abdelsattar

hii I had the same problem. have you find solution ?

TechnologyMaster avatar Jun 08 '17 09:06 TechnologyMaster

Hii @Abdelsattar I found solution . in xml file set this attribute card_view:mrl_rippleOverlay="true" . It will do proper effect .

TechnologyMaster avatar Jun 08 '17 09:06 TechnologyMaster

All part of parent has ripple , we want to set ripple just for cardview with it's radius

Hitexroid avatar Jun 08 '17 20:06 Hitexroid

@Abdelsattar it's working perfect for me. In adapter item layout card view is used . so this is worked for me. Have you also added this property ? card_view:mrl_rippleInAdapter="true" if set then in adapter it's effect will work. Hope this Help.

TechnologyMaster avatar Jun 09 '17 07:06 TechnologyMaster

@TechnologyMaster RecyclerView is not an AdapterView

Hitexroid avatar Jun 19 '17 10:06 Hitexroid

i have an idea , extend MaterialRippleLayout to CardView instead of FrameLayout

example : public class MaterialRippleLayout extends CardView {

but it has a problem , It lefts a dot color in your item during scroll !

Hitexroid avatar Dec 20 '17 13:12 Hitexroid

i have another idea too 😃👍

Edit this line (777) of MaterialRippleLayout my mean ---> public MaterialRippleLayout create() {

edit it to public CardView create() {

then

remove these lines (805 ~ 811) ---> my mean 👇

layout.addView(child, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));

            if (parent != null) {
                parent.addView(layout, index, params);
            }

            return layout;

then , paste these code 👇

 CardView cardView = new CardView(context);
            cardView.addView(layout);
            layout.addView(child, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));

            if (parent != null) {
                parent.addView(cardView, index, params);
            }

            return cardView;

now in ViewHolder in Adapter

   public static class ViewHolder extends RecyclerView.ViewHolder {
        CardView cardView;
        View yourView;

        public ViewHolder(View itemView) {
            super(itemView);
            cardView = (CardView) itemView;
            MaterialRippleLayout rippleLayout = (MaterialRippleLayout) cardView.getChildAt(0);
            yourView = (ViewGroup) rippleLayout.getChildAt(0);
        }
    }

Hitexroid avatar Dec 20 '17 14:12 Hitexroid