Skip to content

Instantly share code, notes, and snippets.

@jarylan
Created July 11, 2016 09:26
Show Gist options
  • Select an option

  • Save jarylan/cdf8540a30041afec83f787d72c09a16 to your computer and use it in GitHub Desktop.

Select an option

Save jarylan/cdf8540a30041afec83f787d72c09a16 to your computer and use it in GitHub Desktop.
Question:
在Android软件设计与实现中我们通常都会使用到ListView这个控件,系统有一些预置的Adapter可以使用,例如SimpleAdapter和ArrayAdapter,但是总是会有
一些情况我们需要通过自定义ListView来实现一些效果,那么在这个时候,我们通常会碰到自定义ListView无法选中整个ListViewItem的情况,也就是无法响应
ListView的onItemClickListener中的onItemClick()方法
Solution:
可以通过对Item Layout的根控件设置其android:descendantFocusability=”blocksDescendants” , 这样Item Layout就屏蔽了所有子控件获取Focus的权限
注意:这个属性不能设置给ListView,设置了也不起作用 ;
@jarylan

jarylan commented Jul 11, 2016

Copy link
Copy Markdown
Author

Focus question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment