Are there any settings to control the "dimensions"...
# compose
b
Are there any settings to control the "dimensions" of @Previews that are rendered?
For example, if I have a
@Preview
that looks like this:
Copy code
Surface(
    modifier = Modifier.fillMaxSize(), 
    color = MaterialTheme.colors.background
) {
    Text("Hello Android!")
}
Then I'll get a preview in Android Studio that looks like this:
Which makes sense, since i used
Modifier.fillMaxSize()
on the Surface composable in the @Preview. But, the preview is clearly making some assumptions there about the dimensions of the screen/device that the composable will be displayed on. Are there any settings or anything in Android Studio to control those assumptions?
m
The
@Preview
annotation accepts a bunch of properties, including
widthDp
and
heightDp
. This blog post is a bit old but should be still decent: https://commonsware.com/blog/2020/06/07/preview-annotation-properties.html
👍 3
b
ah! I always forget that!