views:

45

answers:

1

hello,i have a lisyView,every item(every row ) have a imageView and a textView,when i scroll the listView,the whole item gets the focus,but for every item , frist i want to imageView gets focus,then textViews get focus,so that i can handle the click events of imageView,so my questtion is how to get the focus of imageView .

A: 

To capture clickEvents of a View, you can do a couple different things.

In the XML layout definition of the ImageView, you can specify which method to invoke on a click via the following:

http://developer.android.com/reference/android/view/View.html#attr_android:onClick

Or you can set on OnClickListener on the ImageView.

http://developer.android.com/reference/android/view/View.html#setOnClickListener(android.view.View.OnClickListener)

http://developer.android.com/reference/android/view/View.OnClickListener.html

nicholas.hauschild
thanks,but when i use imageView.OnClickListener it donot work,it trigger listView.itemclick,i want to know imageView how to get focus,so that the imageView.OnClickListener can be trigger.
pengwang