1

In my android application I am using a custom listview to display my records. each element in the list view have 7 textviews which displays information from database.

what I want to do is to disable the entire element selected property completely in the listview, because some textviews in each element itself are clickable links and i want access them using device trackball. Untill it select entire listview elements I cant access those links that resides in each element in the listview using device trackball and to click them.

JibW
  • 4,538
  • 17
  • 66
  • 101
  • Make textview as clickable in xml, and implement click listener for each in you Activity. – Pankaj Kumar Aug 16 '11 at 07:01
  • Yes I did so and each clicks works fine. But if it is touchscreen then can go to each link and click. But when using device trackball to move to each link that resides in each element in list view it selects entire element in the listview(That have all the seven clickable links). Do not let me select each link that resides in the listview elements. So I need to cancel entire listview element selecting property to select each link in the element of the listview – JibW Aug 16 '11 at 07:09
  • make focusable=true for textviews or focusableintouchmode = true. – Pankaj Kumar Aug 16 '11 at 07:25
  • Hi Pankaj, I did them too.. but still it selects entire element. But if touchscreen ok. But I want to make it work for device trackball to move and click...!!!! – JibW Aug 16 '11 at 07:33
  • 1
    http://stackoverflow.com/questions/2098558/listview-with-clickable-editable-widget/2098866#2098866 read all links provided by this answer also – Pankaj Kumar Aug 16 '11 at 08:03

2 Answers2

0

You can set the

android:clickable=false

property of listview. To handle the clicks of the links, you should handle the onClickListener() of the link from within the getView() method of Adapter.

Shafi
  • 1,368
  • 10
  • 24
  • Yes I added android:clickable=false in the list view and checked. But still when I use Device trackball to move, it selects entire element and do not let the user to select each link to to click. – JibW Aug 16 '11 at 07:15
0

In your ListAdapter override the two methods:

@Override
public boolean areAllItemsEnabled() {
    return false;
}

@Override
public boolean isEnabled(int position) {
    return false;
}
Patrick Boos
  • 6,789
  • 3
  • 35
  • 36