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+).
            Asked
            
        
        
            Active
            
        
            Viewed 267 times
        
    1
            
            
        
        RitchyCZE
        
- 44
 - 2
 - 13
 
- 
                    1I 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 Answers
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