Use Coil to render the image.
AsyncImage(
model = "https://example.com/image.jpg",
contentDescription = null
)
You can use a horizontally scrollable Row in Compose.
Row(
modifier = Modifier.horizontalScroll(scrollState)
) {
// ...
}
https://developer.android.com/jetpack/compose/lists
You can make it scroll horizontally with RSB/Bezel with
public fun Modifier.scrollableRow(
focusRequester: FocusRequester,
scrollableState: ScrollableState
): Modifier = composed {
val coroutineScope = rememberCoroutineScope()
onPreRotaryScrollEvent {
coroutineScope.launch {
// events are vertical, but apply horizontally
scrollableState.scrollBy(it.verticalScrollPixels)
scrollableState.animateScrollBy(0f)
}
true
}
.focusRequester(focusRequester)
.focusable()
}
Here is full code example https://github.com/enginer/wear-os-horizontal-scroll-image
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.