1

Is there any way how to make image corners in Jetpack Glance Widget rounded? I know there is a GlanceModifier method cornerRadius, but this is available only in higher versions (S+).

RitchyCZE
  • 44
  • 2
  • 13
  • 1
    I suspect that you would need to round the image itself, before you applied it to your app widget using Glance. That modifier relies on new methods on `RemoteViews`, [such as `setViewOutlinePreferredRadius()`](https://developer.android.com/reference/android/widget/RemoteViews#setViewOutlinePreferredRadius(int,%20float,%20int)), which is why there is a API limit applied on the modifier. – CommonsWare Dec 26 '22 at 22:38

2 Answers2

0

Unfortunately the underlying API to apply the rounded corners is only available in S and there is no easy way to backport that for Glance.

You can either create a drawable with rounded corners in XML or modify at runtime your image and apply the corners there.

Marcel
  • 2,094
  • 3
  • 23
  • 37
0

Use: GlanceModifier.cornerRadius(8.dp)

paulfranco
  • 84
  • 1
  • 3