Skip to content

setOnClickListener doesn't work when MaterialRippleLayout is used from a Custom View #91

@spapapan

Description

@spapapan

This is the Layout I am using which works perfectly when I use it inside the .xml of my Fragment:

         <com.balysv.materialripple.MaterialRippleLayout
                android:id="@+id/orderByFilterBtn"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:mrl_rippleColor="@color/gray_light"
                android:layout_margin="2dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/orderByFilterTxt"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_vertical"
                        android:text="@string/popular"
                        android:layout_marginStart="10dp"
                        />

                    <ImageView
                        android:id="@+id/orderByFilterDown"
                        android:layout_width="15dp"
                        android:layout_height="15dp"
                        android:layout_marginEnd="10dp"
                        android:layout_marginStart="4dp"
                        android:layout_gravity="center_vertical"
                        android:src="@drawable/baseline_arrow_drop_down_gray_24dp"
                        />

                </LinearLayout> 

            </com.balysv.materialripple.MaterialRippleLayout>

But when I try to use it from a Custom View with exactly the same code, the click event never gets called.

view.findViewById(R.id.orderByFilterBtn).setOnClickListener(s->{ //Click Event });

Any ideas why?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions