https://kotlinlang.org logo
#compose
Title
# compose
a

Afzal Najam

12/31/2021, 8:13 PM
Anybody tried LazyColumn or LazyGrid on Android TV? For me, they don't scroll down. See the attached video, first example is with
LazyColumn
, second one is just
Column
with
verticalScroll
modifier. Edit: Looks like this is related to d-pad navigation because when I swipe using
scrcpy
, all the rows are there.
s

sorianog

12/31/2021, 8:57 PM
Do you think it’s a bug with your code or bug with compose in general? What did any official forums say about it?
a

Afzal Najam

12/31/2021, 9:02 PM
I think it's a bug with Compose given that swiping works fine and because there's been issues with d-pad navigation in compose in the past but I'm open to suggestions. The roadmap says d-pad navigation is in-focus so I'm guessing this would be the right time to bring up any bugs with it.
s

sorianog

12/31/2021, 9:49 PM
Bet they’d appreciate your video and a report of what is happening! 🤔
a

Afzal Najam

12/31/2021, 9:50 PM
In the past, I've posted here and verified a behaviour before submitting an issue.
j

Jon Boekenoogen

01/01/2022, 12:15 AM
There is a known issue on lazy lists not scrolling at the moment
Already on the issue tracker
🙌 2
f

FunkyMuse

01/01/2022, 2:10 PM
@Jon Boekenoogen is it for Android TV only or for Phones too?
j

Jon Boekenoogen

01/01/2022, 6:18 PM
Lazy list scrolling with dpad in general (tv, chrome os, phones)
👍 2
t

Tarjeison

01/04/2022, 10:19 AM
We’ve solved this by using
rememberLazyListState
and
scrollBy(px)
to center the items upon focus (
scrollToIndex()
also should work). We’re on version 1.0.5. We experienced the same issue as you, and it seems it’s related to the items not being visible.
❤️ 1
a

Afzal Najam

02/09/2022, 6:52 PM
@Tarjeison Did that completely solve the problem? I tried
scrollBy
and
scrollToIndex
, I think
scrollBy
worked but
animateScrollBy
didn’t. Would it be possible for you to share that part of the code by any chance?
t

Tarjeison

02/10/2022, 8:31 AM
I think this is an issue which occurred in version 1.1.0 and might be the same same as this issue: https://issuetracker.google.com/issues/212982472 I’ve also added a gist in the issue. My team decided to wait for a built in focus navigation support for compose before implementing it on AndroidTV. https://issuetracker.google.com/issues/184670295
a

Afzal Najam

02/10/2022, 5:22 PM
Ah, that makes a lot of sense because I only tried it with 1.1.0. I see that Ralston Da Silva is actively working on it in this CL: https://android-review.googlesource.com/c/platform/frameworks/support/+/1967229. Looks like a while before it’s all done though. I tried it locally a few patch sets ago 🙂
👀 1
48 Views