i am trying to use the jetpack compose but it giving so much errors, one of them is that -
package com.example.imagecardcompose
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import java.lang.reflect.Modifier
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
}
}
@Preview
@Composable
fun Display() {
Column(
modifier = Modifier.fillMaxSize() // here i getting this error
) {
Text(
text = "vishwas",
color = Color.Red)
Text(text = "vishnu")
Text(text = "babar")
}
}
}
error is "Unresolved reference: fillMaxSize".
i checked all my syntax so many times but i not fount any syntax error, please tell me how to use modifiers correctly.
It's because of the wrong import. Please replace
import java.lang.reflect.Modifier
withimport androidx.compose.ui.Modifier