I have a simple vector image:
Source:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="21dp"
android:height="21dp"
android:viewportWidth="5.5563"
android:viewportHeight="5.5563">
<path
android:pathData="m0.2646,0.2646h5.0271"
android:strokeWidth="0.264583"
android:fillColor="#000000"/>
<path
android:pathData="M5.2917,0.5292L0.2646,0.5292"
android:strokeWidth="0.264583"
android:fillColor="#000000"/>
<path
android:pathData="m0.2646,0.2646 l5.0271,5.0271"
android:strokeWidth="0.264583"
android:fillColor="#000000"/>
<path
android:pathData="M1.8521,3.4396 L4.7625,0.7937"
android:strokeWidth="0.264583"
android:fillColor="#800000"/>
<path
android:pathData="M0,0h5.5563v5.5563h-5.5563z"
android:strokeWidth="0.264583"
android:fillColor="#800000"/>
<path
android:pathData="M2.7781,2.7781m-2.7781,0a2.7781,2.7781 0,1 1,5.5563 0a2.7781,2.7781 0,1 1,-5.5563 0"
android:strokeWidth="0.264583"
android:fillColor="#ffff00"/>
</vector>
It's size is 21x21 [px], but as it's a vector it can be freely scaled up.
I wish to use this as a background inside a circle WearOS watch app, so I created a new "Empty Composer Activity", and changed the UI code:
@Composable
fun WearApp(res: Int) {
AppTheme {
Image(
painter = painterResource(id = res),
contentDescription = stringResource(id = R.string.app_name),
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Fit,
)
}
}
Whatever I try, I can't reach my goal. I need this whole image to be inside the watch.
Currently:
Goal:
How am I supposed to do this with the recommended and modern way (with Composer)?
Also, I found this image loading example from the official documentation (link):
Image(
painter = painterResource(id = R.drawable.dog),
contentDescription = stringResource(id = R.string.dog_content_description)
)
But when I was importing the "Image", Android Studio marked it as obsolete:
So what is the most up-to-date source for starting with WearOS development?