onClick not woking go CardView's child element Android

Viewed 96

I am working with CardView. In My CardView, I user LinearLayout as my base Layout holder. The problem I am facing, onClick event of my 'my_card_View' not working while I click on the imageView, But outside the ImageView, The click event work perfectly. Here is my code.

 <com.google.android.material.card.MaterialCardView
                                style="@style/CardViewStyle"
                                android:id="@+id/my_card_View"
                                android:layout_width="0dp"
                                android:layout_height="wrap_content"
                                android:layout_marginEnd="@dimen/_5sdp"
                                android:layout_weight="1"
                                app:cardCornerRadius="@dimen/_5sdp"
                                app:cardElevation="0dp"
                                app:strokeColor="@color/ash"
                                app:strokeWidth="@dimen/_1sdp">
    
                                <androidx.appcompat.widget.LinearLayoutCompat
                                    android:layout_width="match_parent"
                                    android:layout_height="match_parent"
                                    android:paddingTop="@dimen/_10sdp"
                                    android:paddingBottom="@dimen/_10sdp"
                                    android:gravity="center"
                                    android:orientation="vertical">
    
                                    <androidx.appcompat.widget.AppCompatImageView
                                        android:layout_width="@dimen/_50sdp"
                                        android:layout_height="@dimen/_50sdp"
                                        android:duplicateParentState="true"
                                        android:layout_marginTop="@dimen/_7sdp"
                                        android:padding="@dimen/_1sdp"
                                        android:src="@drawable/ic_new_admission" />
    
                                    <com.google.android.material.textview.MaterialTextView
                                        android:layout_width="wrap_content"
                                        android:layout_height="wrap_content"
                                        android:duplicateParentState="true"
                                        android:layout_gravity="center"
                                        android:layout_marginTop="@dimen/_10sdp"
                                        android:text="নতুন ভর্তি"
                                        android:textColor="@color/blue"
                                        app:fontFamily="@font/hind_siliguri_regular" />
    
                                </androidx.appcompat.widget.LinearLayoutCompat>
    
                            </com.google.android.material.card.MaterialCardView>
0 Answers
Related