Modify element to allow it to scroll horizontally when its content is larger than its constraints.
@Sampled
@PreviewWrapper(RemoteComponentPreviewWrapper::class)
@Composable
fun HorizontalScrollSample() {
val scrollState = rememberRemoteScrollState()
RemoteRow(
modifier =
RemoteModifier.size(200.rdp, 100.rdp)
.background(Color.LightGray.rc)
.horizontalScroll(scrollState),
verticalAlignment = RemoteAlignment.CenterVertically,
) {
for (i in 1..10) {
RemoteBox(
modifier =
RemoteModifier.size(80.rdp, 80.rdp).padding(5.rdp).background(Color.Red.rc),
contentAlignment = RemoteAlignment.Center,
) {
RemoteText("Item $i".rs, color = Color.White.rc)
}
}
}
}