1. Download our Official Android App: Forums for Android!

Apps simple question about drawables

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

  1. trueReaper

    trueReaper Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Oct 15, 2010

    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
    Rank:
    None
    Posts:
    0
    Joined:

    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...