I'm facing a logical problem in Jetapck compose, how can Ive the black bock scrolling horizontally and vertically with respectively the green and redbox.
Green and red box can be considered like headers,black box like a content. So :
When scrolling horizontally the red box must remains fixed and visible but the black and green box must scroll together horizontally
When scrolling vertically the green box must remains fixed and visible but the red and green box must scroll together vertically
This the code for the vertical scrolling, in top of that i would like to achieve the horizontal scrolling:
@Composable()
fun MyScrollBox(){
MaterialTheme {
Surface(color = Color.White) {
Box(modifier = Modifier.fillMaxSize()) {
Column {
Row {
Box(modifier = Modifier
.height(50.dp)
.width(50.dp)
.background(Color.Yellow)){
Text(text = "YELLOW BOX")
}
Box(modifier = Modifier
.height(50.dp)
.width(800.dp)
.background(Color.Green)){
Text(text = "GREEN BOX")
}
}
Row(Modifier.fillMaxSize().verticalScroll(rememberScrollState())) {
Box(modifier = Modifier
.width(50.dp)
.height(800.dp)
.fillMaxHeight().fillMaxSize()
.background(Color.Red)){
Text(text = "RED BOX")
}
Box(modifier = Modifier
.width(800.dp).height(800.dp)
.background(Color.Black)){
Text(text = "BLACK BOX", color = Color.White)
}
}
}
}
}
}
}
Thanks for your help