Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Application : Background Image over Background Color

I am new to android development and am developing my first android application. I have the background color of the View set in the layout's xml as follows.

android:background="@+color/bgColor"

Now, i have a full sized transparent background image that i want to lay over the background and then other Elements over that image.

is there a way i can use both background color and background image in the same layout.

Thanks in Advance.

like image 670
Amyth Avatar asked Jul 15 '12 08:07

Amyth


Video Answer


1 Answers

You can use an ImageView with a background color:

<ImageView
    layout_width="match_parent"
    layout_height="match_parent"
    src="@drawable/myImage"
    background="@color/myBgColor" />

Another option is to set the background color in the root element of your layout, and keep the src in your ImageView.

like image 117
Iñigo Avatar answered Oct 11 '22 14:10

Iñigo