首页 > 移动平台 > 详细

Android 7.0 TextView点击事件无效修复方案

时间:2017-06-05 12:18:58      阅读:870      评论:0      收藏:0      [点我收藏+]
public class PostTextView extends TextView {

private Handler handler = new Handler(Looper.getMainLooper());

public PostTextView(Context context) {
super(context);
}

public PostTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}

public PostTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

@Override
public boolean post(Runnable action) {
// FIXME: 2017/5/25 android 7.0以上post方法发生改变,导致点击事件无效
if(Build.VERSION.SDK_INT >= 24){
handler.post(action);
return true;
}
return super.post(action);
}
}

Android 7.0 TextView点击事件无效修复方案

原文:http://www.cnblogs.com/wutianlong/p/6944040.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!