[SOLVED] GlanceAppWidget with clickable row: inner elements steal focus and clicks – Stack Overflow

Issue

This Content is from Stack Overflow. Question asked by E I

I have a widget made with a android glance library. There is a Row contains Image and Text. I need to make this row clickable.

 Row(
        verticalAlignment = Alignment.CenterVertically,
        modifier = GlanceModifier.fillMaxWidth().clickable(
            actionStartActivity(
                createOpenActivityIntent(
                   context = LocalContext.current
                )
            )
        )
    ) {
        Image(
            modifier = GlanceModifier.padding(end = 8.dp),
            provider = ImageProvider(R.drawable.ic_open),
            contentDescription = null
        )
        Text(
            text = LocalContext.current.getString(
                R.string.open
            )
        )
    }

The problem is that the row reacts to click only when I click on its area around of the Text and Image. If I click the Image or Text, nothing happens



Solution

It’s a known bug in Glance 1.0.0-alpha04. You can downgrade to 1.0.0-alpha03 for now, and it should hopefully be fixed in the next release


This Question was asked in StackOverflow by E I and Answered by user496854 It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?