Background image

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Background image

Postby houba » Thu Apr 23, 2009 12:09 am

Hello,

I'd like to know how I can get a really nice background image behind certain text fields and buttons?
How does one do that? I see some really sleek apps out there that have this really nice texture behind the login screen ... how can I do that?

Thanks
houba
Freshman
Freshman
 
Posts: 8
Joined: Wed Apr 22, 2009 8:16 pm

Top

Postby Wubinator » Fri Apr 24, 2009 9:49 pm

I created something using the main.xml (because I want a background image when my application starts)

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.         android:layout_width="fill_parent" android:layout_height="fill_parent"
  6.  
  7.         android:padding="6dip" android:background="@drawable/mainbackground">
  8.  
  9.  
  10.  
  11.         <Button android:id="@+id/getnewchar" android:text="New Character"
  12.  
  13.                 android:layout_height="wrap_content" android:layout_width="fill_parent"
  14.  
  15.                 android:background="@drawable/mainpagebutton" android:textSize="24sp"
  16.  
  17.                 android:textColor="#FFFFFF" android:clickable="true" android:hint="Get a new character"/>
  18.  
  19.  
  20.  
  21. </RelativeLayout>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


As you can see I set android:background="@drawable/mainbackground" on my RelativeLayout tag. This points to the map "res/drawable" in that map I have an image 'mainbackground.png' ..... that's all there is to it.

For the Button I also have a background 'android:background="@drawable/mainpagebutton" ' works the same way.

Hope that helps you
Wubinator
Junior Developer
Junior Developer
 
Posts: 12
Joined: Fri Apr 24, 2009 9:24 pm
Location: Amsterdam

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 2 guests