Layout
<ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false">
<ConstraintLayout
android:layout_width="24dp"
android:layout_height="24dp"
android:translationX="5dp"
android:translationY="5dp"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintEnd_toStartOf="parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@android:color/black"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
</ConstraintLayout>
</ConstraintLayout>
I want to handle click event for imageView
, so I set simple listener for clicking it.
imageView.setOnClickListener {
Log.d("ClickEvent", "imageView Clicked")
}
I can only receive click event when I touch orange area. But I want to receive click event when I touch red area also.
Note that red is clipped area, orange is non-clipped area (red+orange = imageView area) and gray is ConstraintLayout
.
Is there any way to receive click event even if user touch clipped area? (If possible, it can do through code or xml?)