skip to Main Content

I am making an UI on Android Studio.

I want to make a button with background image that I made.

Then I want to write some text on it.

However, when I set the background on button, it is just showing me black color.

I eidted theme.xml file to change status bar’s color to black.


This is the background that I want to apply on button.

OriginalButtonBackground

This picture showing that background image is not applied as I intended.
Main ui screen

This is theme.xml file which I edited to change status bar’s color.
theme.xml

2

Answers


  1. Chosen as BEST ANSWER

    I found solution for this kind of issue!

    it is because of Material components in theme.xml.

    all you need to add to fix this is:

    <style name="btn_style" parent="Widget.MaterialComponents.Button">
        <item name="backgroundTint">@null</item>
    </style>
    

    Write this code in your theme.xml. Then reference it to your button.


  2. I’ve experienced such before.
    Change Button to appCompatButton

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search