在适配2.3设备时,遇到一个问题, 将一个view已经设为GONE了,但是仍能收到touch事件,后来查了下stackoverflow,
http://stackoverflow.com/questions/9333220/buttons-within-view-are-still-clickable-even-though-views-visibility-is-gone
android的viewGroup目前dispatchTouchEvent()时,会做判断:
4.4src
/**
* Returns true if a child view can receive pointer events.
* @hide
*/
private static boolean canViewReceivePointerEvents(View child) {
return (child.mViewFlags & VISIBILITY_MASK) == VISIBLE
|| child.getAnimation() != null;
}
如果当前的非可见的child上还有动画的话,那么也认为可以接受touchEvent,
而2.3貌似在view的动画执行完以后,animation是不会自动clear的,
后来clearAnimation()以后就OK了。