I’m just starting out in Android and was making a splash screen. I tried to change the default background colour to grey, but apparently I can’t use the same attribute twice. How can I add a background image and change the background colour? Thanks.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/reddit_alien"
android:background="@color/grey"
>
</LinearLayout>
One way to do this, which would be to use 2 layouts.. The outer one having a background of the color and the inner one having the image as the background.
Alternatively you could use a layer list drawable resource file in xml which defines one layer as being the background color and another as the background image. see here: http://developer.android.com/guide/topics/resources/drawable-resource.html#LayerList