注意,这个需求的Image不是固定的,而是针对当前ImageView上的图片。也就是说用Selector的做法是不行的。
public class PressedRoundImageView extends ImageView {
private boolean showZheZhao = false;
public PressedRoundImageView(Context context) {
super(context);
}[......]
注意,这个需求的Image不是固定的,而是针对当前ImageView上的图片。也就是说用Selector的做法是不行的。
public class PressedRoundImageView extends ImageView {
private boolean showZheZhao = false;
public PressedRoundImageView(Context context) {
super(context);
}[......]
如果子元素恰好有 pressed的selector,会导致跟着一起联动,比较不美观。
解决方法:在出问题子元素的所有layout父容器上,加上clickable=true
参考资料:
http://stackoverflow.com/questions/11474247/list-item-click-triggering-child-views-selector
http://stackoverflow.com/questions/2607698/click-in-a-[......]
转载自:https://zhuanlan.zhihu.com/p/20308548
作者:MagiLu
链接:https://zhuanlan.zhihu.com/p/20308548
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
作者:johnczchen
出品:QQ空间终端开发团队
原文发布于QQ空间终端开发团队的官方公众号,任何形式的转载之前必须与本人联系。
1.背景
当一个App发布之后,突然发现了一个严重bug需要进行紧[......]