开发者

Android Compound Control internal click events

I'm writing a custom compound control that extends RelativeLayout. Inside this component, there is an ImageView. I add a OnClickListener to this ImageView to animate it when the user clicks on it. But when I am in an activity using this control and I add a OnClickListener on the control, this listener is never called. It only works when I remove the othe开发者_运维问答r listener I have on the ImageView. Does anybody knows how to "propagate" the event to the other listeners when I catch it inside the control?

Thanks!

PS: I would also like to know if there is an existing control that looks like the icons on the Android desktop. Like an icon with text underneath.


Try setting one of these to true on your component:

android:clickable

android:focusable

android:focusableInTouchMode

android:longClickable

android:descendantFocusability

I had the same problem when I putted a button inside a ListView, I had to change one of the parameters to make the row be clickable, not only the button.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜