Skip to content Skip to sidebar Skip to footer

A Textview In A Listview' S Row Cannot Click After Setting Descendantfocusability="blocksdescendants"

I write a customized item layout for a listview. The layout has many widgets and some will have its own clicklistener. When I click the row, sometimes the listview' s onListItemCli

Solution 1:

After spenting some time trying, I solved both.

  1. the first. if your customized listview' s layout has a textview which has been set autolink or Linkify in the code, the click event in the textview won' t affect the list' s row. You have to extends your own TextView and overrideonTouchEvent method. please see it here

  2. the second. just set in the customized listview' s root node: android:descendantFocusability="blocksDescendants", and then, in your widget which will have its own onClickListener, set android:clickable="true", it works for me.

hope it useful for those you encounter the same:-)

Post a Comment for "A Textview In A Listview' S Row Cannot Click After Setting Descendantfocusability="blocksdescendants""