Isuru Isuru - 1 month ago 16
Android Question

Change background colour of Activity

I have created an Android project and included Navigation Drawer Activity.

enter image description here

But the backgrounds of the activities are black.

enter image description here

I know I can change the background colour to white using XML or Java. But every time I do that I need to change other views as well. I checked the styles file. But it doesn't contain any tag about the background colour.

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>


Is there any solution for that? Thank you!

Answer

Extend your app Theme from Theme.AppCompat.Light