Set Background Image for Whole List View

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

Set Background Image for Whole List View

Postby maneesh_17 » Thu Jan 07, 2010 9:09 pm

Hi,

I want to set common Background Image for whole list View.When i put the background image in xml it comes with each element of list view.

Do somebody have an idea how to resolve it ?

Here is my xml code.

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3.  
  4.  
  5. <AbsoluteLayout android:id="@+id/widget0"
  6.  
  7.          android:layout_width="fill_parent"
  8.  
  9.         android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">!--
  10.  
  11.        
  12.  
  13.         <!--<ImageView android:id="@+id/upper_blue_tab1"
  14.  
  15.                 android:src="@drawable/upper_blue_tab"
  16.  
  17.                 android:layout_width="wrap_content"
  18.  
  19.                 android:layout_height="100px"
  20.  
  21.                 android:layout_y="-30px"
  22.  
  23.                 android:focusable="true"/>
  24.  
  25.                
  26.  
  27.                        
  28.  
  29.         --><TextView
  30.  
  31.                 android:id="@+id/list"
  32.  
  33.                 android:layout_width="wrap_content"
  34.  
  35.                 android:layout_height="wrap_content"
  36.  
  37.                 android:textColor="#000000"
  38.  
  39.                 android:text="title"
  40.  
  41.                 android:clickable="true"
  42.  
  43.                 android:textSize="20px"
  44.  
  45.                
  46.  
  47.                 />
  48.  
  49.        
  50.  
  51.  
  52.  
  53. </AbsoluteLayout>
  54.  
  55.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


I m using the array adapter into java code.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  
  3.  
  4. setListAdapter(new ArrayAdapter<String>(this, R.layout.title,
  5.  
  6.                                 R.id.list, title));
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
maneesh_17
Junior Developer
Junior Developer
 
Posts: 17
Joined: Tue Sep 08, 2009 12:27 am
Location: Gurgaon,India

Top

Postby icobasco » Wed Jan 13, 2010 10:21 am

hi maneesh_17,

you have to put the background to the list (ListView), not on the TextView which represents the single line.

As you do by now, every TextView gots its background ;)
User avatar
icobasco
Senior Developer
Senior Developer
 
Posts: 108
Joined: Thu Jun 04, 2009 11:12 am
Location: Italy

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: Exabot [Bot] and 7 guests