zoukankan      html  css  js  c++  java
  • Android 7.0 TextView点击事件无效修复方案

    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);
    }
    }
  • 相关阅读:
    闭包
    iframe
    函数声明和函数表达式
    简单的事件委托
    onhashchange
    WebP探索
    Chrome
    适合自己学习的一些网站
    模拟jQuery的一些功能
    __autoload()方法
  • 原文地址:https://www.cnblogs.com/wutianlong/p/6944040.html
Copyright © 2011-2022 走看看