Home > Software engineering >  Background image is not showing right on button
Background image is not showing right on button

Time:09-06

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

CodePudding user response:

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.

CodePudding user response:

I've experienced such before. Change Button to appCompatButton

  • Related