Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add background image to activity?

using theme or ImageView ?

like image 611
Vladimir Berezkin Avatar asked Jul 22 '10 08:07

Vladimir Berezkin


People also ask

How do I turn on background activity on Android?

Here's how: Go to Settings > General > Background App Refresh. From the list of apps shown, use the toggle to turn Background App Refresh on or off for each app.

Can activity run in background android?

However, activity can't be run unless it's on foreground. In order to achieve what you want, in onPause(), you should start a service to continue the work in activity. onPause() will be called when you click the back button.


1 Answers

use the android:background attribute in your xml. Easiest way if you want to apply it to a whole activity is to put it in the root of your layout. So if you have a RelativeLayout as the start of your xml, put it in here:

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/rootRL"     android:orientation="vertical"      android:layout_width="fill_parent"     android:layout_height="fill_parent"      android:background="@drawable/background"> </RelativeLayout> 
like image 85
Sephy Avatar answered Oct 11 '22 12:10

Sephy