import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
@Composable
fun SimpleListScreen() {
val itemsList = List(10) { index -> "Item ${index + 1}" }
Scaffold(
topBar = {
TopAppBar(title = { Text("Simple List Screen") })
}
) { paddingValues ->
LazyColumn(modifier = Modifier.padding(paddingValues)) {
items(itemsList) { item ->
Text(text = item, modifier = Modifier.padding(16.dp))
}
}
}
}This solution creates a list of 10 strings labeled from "Item 1" to "Item 10" using Kotlin's List constructor.
Inside the Scaffold's content, a LazyColumn is added with padding from the Scaffold to avoid overlap with the top bar.
The items() function is used to display each string as a Text composable with 16.dp padding for spacing.
This creates a scrollable vertical list with a top app bar titled "Simple List Screen".