Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
Android Widget with Glance make around corners for SDK lower than 31

Announcing Jetpack Glance Alpha for app widgets. However rounded corners do not work for SDK lower than 31 (Android 12). Ideally, you would want to change the background color with rounded corners programmatically.

Does anyone have an idea for a workaround for this issue?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

I faced this issue. And, I solved the problem with background drawable. Give background drawable to your root.

MyWidgetClass.kt

    @Composable
    override fun Content() {
        Column(
            modifier = GlanceModifier
                .width(170.dp).height(130.dp)
                .background(ImageProvider(R.drawable.background_widget))
                .padding(8.dp)
        ) {
            //...
        }
    }

background_widget.xml

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#FFFFFFFF" />

    <corners android:radius="10dp" />
</shape>
over 4 years ago · Santiago Trujillo Report

0

An easy way to add rounded corners is this, but it works for Android S +.

@Composable
override fun Content() {
    Column(
        modifier = GlanceModifier
            .width(170.dp).height(130.dp)
            .background(color = Color.Gray)
            .cornerRadius(8.dp)
    ) {
        //...
    }
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!