jc12
jc12

Reputation: 1829

How to do scrollable clickable text in Glance widget?

I want to do the following:

Column(modifier = modifier.verticalScroll().clickable(
   onClick = actionStartActivity(MainActivity::class.java)
)) {
    Text(text = "some really long text")
}

The problem is that there is no verticalScroll modifier, so the only way I can figure out how to get the content to scroll is by using a LazyColumn, however if I try to add a clickable modifier to the LazyColumn then the widget won't load. If I wrap the LazyColumn in a Column I can then add the clickable modifier to the Column, but then clicking anywhere on the text only briefly highlights the text, it doesn't perform the clickable action.

Is there a way to accomplish this currently in Glance?

Upvotes: 3

Views: 920

Answers (1)

jc12
jc12

Reputation: 1829

Looks like if I put a clickable modifier on every item inside of the LazyColumn then it pretty much accomplishes what I'm trying to do. It would be nice if I could just put a clickable modifier on the whole LazyColumn instead though or at least be able to put it on a wrapping Column. It would also be nice if I could just use a Column instead of needing to use a LazyColumn just to get it to be scrollable.

Upvotes: 0

Related Questions