ArrayAdapter + setListAdapter quirk

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

ArrayAdapter + setListAdapter quirk

Postby BGH » Sun Mar 22, 2009 10:49 am

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. setListAdapter(new ArrayAdapter<String>(this,
  2.  
  3.    android.R.layout.simple_list_item_1, SPORTS));
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


I use the above code to just display a simple list. SPORTS is a simple String array.

But the problem is that users can only select by clicking on the actual text, not that line of text. Plus when they select it only the text part of the line is highlighted, not the entire line (see pic).

How can I get it so that users can select an item by tapping anywhere on the line, rather than on the text itself. I presume in the process this will fix the problem of only the text being highlighted as well.
Attachments
emulator.jpg
emulator.jpg (55.84 KiB) Viewed 246 times
User avatar
BGH
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Feb 12, 2009 3:51 am
Location: Melbourne, Australia

Top

Postby asolanki » Mon Mar 23, 2009 5:47 am

hello
In this view you may be using one text view. so just make that text view's width=fill parent.
and let me know if it worked or not
asolanki
Senior Developer
Senior Developer
 
Posts: 151
Joined: Thu Jan 08, 2009 7:32 am

Postby BGH » Mon Mar 23, 2009 9:16 am

Bah how stupid can I be?!?

This worked of course, I knew it had to be something simple. Thanks for pointing it out :)
User avatar
BGH
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Feb 12, 2009 3:51 am
Location: Melbourne, Australia

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 9 guests