Tried the following and it worked, just a workaround and it may not be the optimal solution
activity_main.xml
<ConstraintLayout
android:id="@+id/container"
android:onClick = "doSomething"
...>
<child1/>
<child2
android:onClick="doNothing"/>
<child3/>
</ConstraintLayout>
Activity class
//all but child2 responds to the clickevent
fun doNothing(view: View) {
//does nothing,empty function
}
fun doSomething(view: View) {
Toast.makeText(this, "did something", Toast.LENGTH_SHORT).show()
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…