simple question about drawables


Last Updated:

  1. trueReaper

    trueReaper New Member This Topic's Starter

    Joined:
    Oct 15, 2010
    Messages:
    1
    Likes Received:
    0
    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 Active Member

    Joined:
    Feb 15, 2010
    Messages:
    41
    Likes Received:
    2
    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...