Personalized ListView

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

Personalized ListView

Postby andreleitao » Wed Jun 17, 2009 6:41 pm

Hi, folks!

I'm learning at this moment how to manipulate ListView class. I know to show on the screen a simple list containing String elements. But I would like to know if is possible to do something like the attached image on this post. I want to display an image that completes an item fully. I would like also to know if I can make an item with an image and a text, at the same time.

My current code:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public class ExperimentoActivity extends Activity {
  3.  
  4.        
  5.  
  6.         private ArrayAdapter<String> aa;
  7.  
  8.  
  9.  
  10.         @Override
  11.  
  12.         protected void onCreate(Bundle savedInstanceState) {
  13.  
  14.                 super.onCreate(savedInstanceState);
  15.  
  16.  
  17.  
  18.                 ArrayList<String> al = new ArrayList<String>();
  19.  
  20.                 al.add("OPTION 1");
  21.  
  22.                 al.add("OPTION 2");
  23.  
  24.                
  25.  
  26.                 setContentView(R.layout.main);
  27.  
  28.                 ListView lv = (ListView)findViewById(R.id.list);
  29.  
  30.                
  31.  
  32.                 aa = new ArrayAdapter<String>(getApplicationContext(),
  33.  
  34.                                 android.R.layout.simple_list_item_1,al);
  35.  
  36.        
  37.  
  38.                 lv.setAdapter(aa);
  39.  
  40.         }
  41.  
  42.  
  43.  
  44. }
  45.  
  46.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4




Can you help me?

Thanks. :)
Attachments
IMAGEVIEW.PNG
IMAGEVIEW.PNG (15.22 KiB) Viewed 150 times
andreleitao
Experienced Developer
Experienced Developer
 
Posts: 70
Joined: Tue Mar 10, 2009 9:56 pm
Location: Recife - Brazil

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests