How to set background for all activities in adnroid application and keep it's aspect ratio?
I am using android:windowBackground
in style, but I don't know, how to keep aspect ratio for my background image.
Is there only way to add ImageView
with background for all activities manually?
You might be able to set the background in the styles.xml
<style name="AppTheme.FullBackground" parent="AppTheme">
<item name="android:background">#757575</item>
</style>
(Where AppTheme
might be a theme you already defined, and I just used a grey color there, but it can be a drawable)
Then add to your Manifest
<activity
android:name=".FooActivity"
android:theme="@style/AppTheme.FullBackground">
</activity>
Since you have to add activities to the Manifest anyway, this is a good way to check if all the activities have the background. You, of course, could still extend the BaseActivity
and only have the BaseActivity
class maintain the theme setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With