daniel-stoneuk / material-about-library

Makes it easy to create beautiful about screens for your apps
Apache License 2.0
1.12k stars 140 forks source link

Unable to change theme #57

Closed ujwalp15 closed 7 years ago

ujwalp15 commented 7 years ago

This is my current style which has the required colors.

where, Color primary is #2a2153 colorPrimaryDark is #221a45 colorAccent is #d1005b

Even though I have applied it, but my background color is not changing, its still set to some default value near "#212121". Am I doing anything wrong?

daniel-stoneuk commented 7 years ago

So you want to change the background colour? The colours you have changed only change the AppBar and status bar.

Try <item name="android:windowBackground">@color/<yourcolorhere></item>

ujwalp15 commented 7 years ago

Thanks for that, now I have half part done, ie window background is the color I want, but the card color is still set to some default value near "#212121" due to Theme.Mal.Dark.DarkActionBar, how do I change it. I tried @color/background, although this works but, I dont get that cool "light-dark(card)/dark(background window)" combination.

check this for more: Image

daniel-stoneuk commented 7 years ago

Ah okay, well in that case you're going to want to set the theme to light as if you just changed the card background, the text will be the wrong colour.

Try using a light theme and then manually overriding the status bar to make the text and button dark - check out the source code or let me know if you need help doing that.

ujwalp15 commented 7 years ago

that didn't work, I still dont get that dark background with semi-dark cards. Check this default implementation.Image, and this is what I got after adding "android:background" Image, I need background to be dark and card to be medium dark, like the stock implementation, just with a different color scheme. may I know from where is the card background color fetched?

daniel-stoneuk commented 7 years ago

The card background colour isn't actually fetched from a specific value - it's what AppCompat sets it in the theme.

ujwalp15 commented 7 years ago

In that case, I need help. The moment I set Light theme, the background goes white, then is I use the windowBackground it doesn't update card background. To update card background I have to use android:background which works but then it also applies it to the activity background. I am not finding any way to add 2 different color one for background and another for card background. Any insight would be highly appreciated

Robyer commented 7 years ago

I find out card background can be changed by setting <item name="android:colorBackgroundFloating">@color/red</item> but it seems it is available from API 23. And perhaps it changes more things than necessary.

Better would be to apply custom style to the cards internally in MAL library and expose the background color via some custom attribute... You can try to provide pull request for that.

daniel-stoneuk commented 7 years ago

Sorry again for the inactivity - been caught up in exams but am always happy for PRs!

ujwalp15 commented 7 years ago

Man! this did the trick. You are amazing, thank a ton!

Robyer commented 7 years ago

@ujwalp15 Just make sure it works properly on devices with different Android APIs as Android Studio raises error/warning that it is supported only on API 23 and above. So I don't know how it will behave on older API versions...