Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个自定义 ListView,在 List 中有 3 ImageView 和 4 Textview 。我无法点击列表项,我可以点击空白空间。那么如何点击列表项和 onClick 侦听器应该工作?
如果您的列表单元格中有可点击的视图,则必须通过调用将这些视图设置为不可聚焦(在代码中,在设置 onClickListeners 之后)以使单元格也可点击:
myCellButton.setOnClickListener(buttonClickListener); myCellButton.setFocusable(false);