0

I have problems with my rounded_corners.xml drawable.

I need to have rounded buttons in my app and to do that I've created a rounded_corners.xml file, looking like this:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <corners android:radius="16dp"/>
    <solid android:color="#FFFA00"/>
</shape>

and applied it to the buttons like this:

android:background="@drawable/rounden_corners"

and it works just fine... as long, as the Theme of the app in the AndroidManifest.xml is default. Which in my case is:

android:theme="@style/Theme.AppCompat.NoActionBar">

but as soon as I change it to:

android:theme="@style/Theme.MyTheme">

it stops working. I seems as if the drawable rounded_corners.xml was not recognised.

Here are some screenshots:

Theme.AppCompat.NoActionBar Theme.MyTheme

Ps: the font and colors of the text change because I have differen values for it in MyTheme as in the Theme.AppCompat.NoActionBar

m.w.a8
  • 1
  • 1
  • Hello, is your `MyTheme` inherited from some of `Theme.MaterialComponents` themes? – art Apr 14 '21 at 09:32
  • @art hi yes it is. This is it: – m.w.a8 Apr 14 '21 at 09:35
  • The question is closed, though you can read about material buttons theming [here](https://material.io/components/buttons/android#theming-buttons). – art Apr 14 '21 at 09:41
  • Thanks a lot. I didn't find the answer on StackOverflow, but if anyone needed it here it is: https://www.youtube.com/watch?v=K3AZaOekJps – m.w.a8 Apr 14 '21 at 11:19

0 Answers0