i have a listview, my problem is that a “click” will register only if i press on the text, and not on the line itself.
how can i change that?
public class Listwithbaseadapter extends ListActivity {
static final String[] MOBILE_OS =
new String[] { "Android", "iOS", "royi", "Blackberry"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new MobileArrayAdapter(this, MOBILE_OS));
ListView listView = getListView();
listView.setCacheColorHint(0);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
//get selected items
String selectedValue = (String) getListAdapter().getItem(position);
Toast.makeText(this, selectedValue, Toast.LENGTH_SHORT).show();
}}
Thanks!
change the android:layout_width=”wrap_content” to android:layout_width=”fill_parent” in the xml. Thanks anyway.