5

I am trying to run a simple LazyColumn Object, but am unable to run it without this weird error. Here is my code:

@Composable 
fun Test(){
    LazyColumn() {
        Text(text = "Placeholder", fontSize= 30.sp)
        Spacer(modifier = Modifier.padding(10.dp))
    }
}

Here are the errors:

org.jetbrains.kotlin.diagnostics.SimpleDiagnostic@74c0fa2 (error: could not render message)

org.jetbrains.kotlin.diagnostics.SimpleDiagnostic@c077eec3 (error: could not render message)

Is it something wrong with my code, or is it a bug? *I wanted to test the scroll function by copy and pasting the lines after the LazyColumn() statement over and over

1 Answer 1

8

With 1.0.0-beta04 you can use:

val itemsList = (0..50).toList()
LazyColumn() {
    items(itemsList) {
        Text(text = "Placeholder", fontSize = 30.sp)
        Spacer(modifier = Modifier.padding(10.dp))
    }
}

In the LazyListScope in order to display the items you have to use one the provided functions:item, items, itemsindexed and stickyHeader.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.