Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
spapapan opened this issue Sep 11, 2022 · 0 comments

Comments

@spapapan
Copy link

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?

@spapapan spapapan reopened this Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant