10

what would i need to add to this so that i have a background image and a background colour for main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="330dp"
android:layout_height="600dp"
android:layout_gravity="center|center_vertical"
android:background="@drawable/background"
>
MrJoshFisher
  • 1,143
  • 5
  • 21
  • 48

1 Answers1

10

You should be able to simply fill the parent and then set your background image accordingly.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
>
Aaron McIver
  • 24,527
  • 5
  • 59
  • 88
  • 2
    Question is he need background Image and color not only background image that fills whole layout. – Mubeen Ali Sep 02 '14 at 19:12
  • 2
    answering my own question which wasnt even the correct answer, to the question I asked. 2 years later android:background="@color/white" in strings.xml add #FFFFFF http://stackoverflow.com/questions/2748830/how-to-change-background-color-in-android-app – MrJoshFisher Feb 23 '16 at 19:57