MaterialAbout icon indicating copy to clipboard operation
MaterialAbout copied to clipboard

Adapting MaterialAbout background to Material Dark Theme

Open ankandrew opened this issue 1 year ago • 1 comments

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.

photo_2022-07-24_12-37-20

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?

ankandrew avatar Jul 24 '22 15:07 ankandrew

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)

ankandrew avatar Aug 02 '22 01:08 ankandrew