1. Check out our companion app, Forums for Android! Download from Google Play

simple question about drawables

Discussion in 'Application Development' started by trueReaper, Oct 15, 2010.

  1. trueReaper

    trueReaper New Member
    Thread Starter
    5

    Oct 15, 2010
    1
    0
    5
    Hey, im pretty new to programing for the android and im running into some problems.
    I have two separate questions which i think have pretty simple answers.

    First. I want to have a defalt image as my background but i would also like it the user to be able to chose a image from their photos or take a picture from their camera and set that as the background.

    If you post code could you please commit it or explain it? I would like to understand how one does this.

    Thank you for your time.
     

    Advertisement

  2. Extodus

    Extodus Guest

    Adding:

    Code (Text):
    1. android:background="@drawable/background"
    to your Layout declaration in your .xml file will use a file named "background" from your res/drawable folder. So your main.xml looks like:

    Code (Text):
    1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    2.     android:layout_width="fill_parent"
    3.     android:layout_height="fill_parent"
    4.     android:background="@drawable/background">
    5.  
    6. <!-- all your other views and layout stuff here -->
    7.  
    8. </RelativeLayout>
    9.  
    10.  
     

Share This Page

Loading...