Danail
Danail

Reputation: 10583

How to catch onClick on ListView (I don't want onItemClickListener)

How to catch onClick on ListView?

I need to catch the on click event even if there are no items in the list. I tried to put onClickListener on the parent view of the ListView, but the ListView absorbs the event and doesn't let me know.

How can I catch that and process this event?

Please Help Me,

Thanks, Dan

Upvotes: 0

Views: 161

Answers (2)

FrancescoAzzola
FrancescoAzzola

Reputation: 2654

Try to create the custom component extending the ListView and override the onclick method.

Upvotes: 0

Intathep
Intathep

Reputation: 3388

one simple and stupid way if you dont want onitemclick

<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>

.

 then put onClickListener to ImageView 

:P

Upvotes: 1

Related Questions