我正在尝试使用Android Jetpack Compose将图像添加到活动中,但它出现了错误:
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.Image
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Image(bitmap = imageFromResource(res = resources, resId =R.drawable.ic_launcher_background))
}
}
}