How do you display an image in compose? ```Image( ...
# compose
p
How do you display an image in compose?
Copy code
Image(
    painter = painterResource(id = R.drawable.logo),
    contentDescription = null
)
I saw that in the docs, but it does not work. Do assets usually go in /res/drawable ? I saw another google guide saying to make a new folder called "assets"
z
The drawable folder should be made automatically. Can you show a screenshot of your emulator showing that this code doesn’t work, including the rest of the code you wrote?
p
@Pablo Carbajal You must import your R (resources) package to be able to use R.type.id, i.e: import com.CompanyDomain.ProjectName.PackageName Being so: import com.pabloCarbajal.NewProject.R Also it may or may not depend on which version of compose you're currently using. Here an example of how to implement the code you shared:
p
Thanks for the reply @Zun and @Patrick Duarte
🙂 1
347 Views