Android 如何在ListView上捕获onClick(我不希望使用onClick侦听器)

Android 如何在ListView上捕获onClick(我不希望使用onClick侦听器),android,listview,adapter,onclicklistener,Android,Listview,Adapter,Onclicklistener,如何在ListView上单击onClick 我需要捕捉点击事件,即使列表中没有项目。我试图将onClickListener放在ListView的父视图上,但ListView吸收了事件,不让我知道 我怎样才能捕捉到这一点并处理这一事件 请帮帮我 谢谢, Dan如果你不想被人舔的话,这是一个简单而愚蠢的方法 <RelativeLayout android:layout_width="match_parent" android:layout_height="match_paren

如何在
ListView
上单击
onClick

我需要捕捉点击事件,即使列表中没有项目。我试图将onClickListener放在ListView的父视图上,但ListView吸收了事件,不让我知道

我怎样才能捕捉到这一点并处理这一事件

请帮帮我

谢谢,
Dan如果你不想被人舔的话,这是一个简单而愚蠢的方法

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

<ListView 
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</ListView>

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</ImageView>

</RelativeLayout>

:p

尝试创建扩展ListView的自定义组件并重写onclick方法。

选中此项。。并在OnClickListener中检查数组的大小,若其狡猾的计划:)将尝试:)不起作用。它吸收了事件。该死OnTouchListener也有问题——它要么吸收事件(如果您返回true),要么不处理它(如果您在ACTION\u DOWN上返回false)。
 then put onClickListener to ImageView