fabiocollini
09/08/2021, 8:29 AMAndroidView
. Using just views a FrameLayout
above something else it doesn’t intercept any touches, instead using an AndroidView
on top of a composable all the touches are interceptedfabiocollini
09/08/2021, 11:53 AM<FrameLayout xmlns:android="<http://schemas.android.com/apk/res/android>"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Click here!" />
<FrameLayout
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#2FFF"/>
</FrameLayout>
Adding a clickListener on text it works (even if there is a FrameLayout
above it). Doing something similar using Compose all the touches are intercepted by the `AndroidView`:
Box(modifier = Modifier.fillMaxSize()) {
Text(
modifier = Modifier
.align(Alignment.Center)
.clickable { println("Clicked!") },
text = "Click here!"
)
AndroidView(
factory = {
FrameLayout(it)
},
modifier = Modifier.fillMaxSize()
)
}
Is this the expected behavior? Is there an easy way to obtain the same behavior we have using just views?Colton Idle
09/08/2021, 4:50 PMfabiocollini
09/09/2021, 7:08 AMAlexandre Elias [G]
09/09/2021, 6:35 PMAlexandre Elias [G]
09/09/2021, 6:39 PMrequestDisallowInterceptTouchEvent
in the update
block fix this for you?fabiocollini
09/15/2021, 3:28 PMfabiocollini
09/15/2021, 3:29 PMrequestDisallowInterceptTouchEvent
in the update
block but it doesn’t fix the issue. I have filed a bug here: https://issuetracker.google.com/issues/199918391fabiocollini
09/15/2021, 3:29 PM