4127157
4127157

Reputation: 1458

No resource found that matches the given name: attr 'colorBackground'

I am trying to edit the ThemeOverlay here which contains the dewfaults regarding the popups and dialogs and things like that but the problem is that it is not accepting the colorBackground attribute.

I know that some will say that I should use android:colorBackground but if I am inheriting from AppCompat then it should not be a problem. Please help.

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base">
    <!-- Customize your theme here. -->
</style>

<style name="AppTheme.Base" parent="Theme.AppCompat.NoActionBar">
    <item name="colorPrimary">@color/Primary</item>
    <item name="colorPrimaryDark">@color/PrimaryDark</item>
    <item name="colorAccent">@color/Accent</item>
</style>

<style name="PopupTheme" parent="ThemeOverlay.AppCompat.Light">
    <item name="colorBackground">@color/TextColor</item>
</style>
</resources>

Also, even after applying android:colorBackground it doesn't work. The error is gone but what I want to get done doesn't happen.

Upvotes: 2

Views: 2113

Answers (2)

Bobo Diet
Bobo Diet

Reputation: 11

changing

<style name="PopupTheme" parent="ThemeOverlay.AppCompat.Light">
     <item name="colorBackground">@color/TextColor</item>
</style>

to

<style name="PopupTheme" parent="ThemeOverlay.AppCompat.Light">
     <item name="android:windowBackground">@color/TextColor</item>
</style>

Upvotes: 1

Jorgesys
Jorgesys

Reputation: 126563

Try changing to :

<style name="PopupTheme" parent="ThemeOverlay.AppCompat.Light">
    <item name="android:background">@color/TextColor</item>
</style>

i think you are trying to change the background, why not using an image:

 <item name="android:background">@drawable/your_drawable</item>

Upvotes: 3

Related Questions