Android mobile guard-event transfer & response rules, android guard-Transfer
Question:
This article address: http://www.cnblogs.com/wuyudong/p/5911187.html, reproduced please indicate the source address.
In the previous article, the TextView text is changed when you click the SettingItemView entry, but when you select the checkbox in the custom control SettingItemView, The TextView text is not changed.
Here you need to understand the event Transfer Process
SettingActivity corresponds to the click event for obtaining the layout of the layout file. This event is passed to SettingItemView.
1. Click in the SettingItemView non-CheckBox area, and the event will be responded by SettingItemView
2. Click the CheckBox area in SettingItemView. The event is passed to the CheckBox by SettingItemView, And the CheckBox responds.
When the CheckBox responds to the current Click Event, the SettingItemView will no longer be able to respond to this event, and The onClick method cannot be called to change the status.
The solution to this problem is to prevent the checkBox from responding to the click event.
<! -- Android: clickable = "false" android: focusable = "false" android: focusableInTouchMode = "false" prevents the current CheckBox from being clicked, that is, it cannot respond to events --> <CheckBox android: id = "@ + id/cb_box" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_alignParentRight = "true" android: layout_centerVertical = "true" android: clickable = "false" android: focusable = "false" android: focusableInTouchMode = "false"/>