Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to change theme #57

Closed
ujwalp15 opened this issue May 5, 2017 · 10 comments
Closed

Unable to change theme #57

ujwalp15 opened this issue May 5, 2017 · 10 comments
Labels

Comments

@ujwalp15
Copy link

ujwalp15 commented May 5, 2017

This is my current style which has the required colors.

<style name="AppTheme.MaterialAboutActivity" parent="Theme.Mal.Dark.DarkActionBar" > @color/colorPrimary @color/colorPrimaryDark @color/colorAccent </style>

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
Copy link
Owner

daniel-stoneuk commented May 5, 2017

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
Copy link
Author

ujwalp15 commented May 5, 2017

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
Copy link
Owner

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
Copy link
Author

ujwalp15 commented May 5, 2017

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
Copy link
Owner

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

@ujwalp15
Copy link
Author

ujwalp15 commented May 5, 2017

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
Copy link
Collaborator

Robyer commented Jun 1, 2017

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
Copy link
Owner

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

@ujwalp15
Copy link
Author

ujwalp15 commented Jun 1, 2017

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

@ujwalp15 ujwalp15 closed this as completed Jun 1, 2017
@Robyer
Copy link
Collaborator

Robyer commented Jun 1, 2017

@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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants