I am trying to write an application which takes items from a database and populates rows within a ListView. I can\'t click on the items after tapping on the rows and the dpa
Tried this?
@Override
public boolean isEnabled(int position) {
//Set a Toast or Log over here to check.
return true;
}
Add the line below to your ListView xml
android:choiceMode="singleChoice"
I usually put the click listener in the adapter itself:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
OnClickListener yourClickListener = new OnClickListener() {
public void onClick(View v) {
//put your desired action here
v.callOnClick();
}
};
...
// then add the listener to your view
tweetView.setOnClickListener(yourClickListener);
Usually this happens because the items in your listview are in focus. Try adding
android:descendantFocusability="blocksDescendants"
in your custom listview row
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants">
add inside onItemClick method:
v.setSelected(true);