MaterialAbout
MaterialAbout copied to clipboard
Adapting MaterialAbout background to Material Dark Theme
When using Material
theme rather than AppCompat
one, I get different a different color in the FrameLayout
background than in in the main view background, i.e.
Note: I'm using the latest version of MaterialAbout
(0.3.0
).
To reproduce this I just changed:
from
https://github.com/jrvansuita/MaterialAbout/blob/f8bd427bbbaf8a9f41d8b533a7f2bef8b57d6627/app/src/main/res/values-v21/styles.xml#L3
to
<style name="AppThemeDark" parent="Theme.MaterialComponents.NoActionBar">
How can I set the MaterialAbout
view to have the same background color as the one observed in the outer view of the image?
My current workaround is to use setBackgroundColor and pass the value returned by this method:
private int getThemeBackgroundColor() {
TypedValue outValue = new TypedValue();
getTheme().resolveAttribute(android.R.attr.windowBackground, outValue, true);
return outValue.data;
}
I guess this is not ideal, because I should also pass the text color (also seems different in AppCompat theme and Material* themes)