安卓的背景色设置需要根据SDK的版本来分情况考虑:

if (Build.VERSION.SDK_INT >= 16) {
textView.setBackground(null);
} else {
textView.setBackgroundDrawable(null);
}

【bug】java.lang.NoSuchMethodError: android.widget.TextView.setBackground的更多相关文章

  1. 关于java.lang.NoSuchMethodError: android.widget.RelativeLayout.setBackground的解决办法

    今天用一个安卓4.0.4版本的手机测试手上的项目,发现logcat弹出这样一个提示“java.lang.NoSuchMethodError: android.widget.RelativeLayout ...

  2. 【Exception】 java.lang.NoSuchMethodError: android.app.AlertDialog$Builder.setOnDismissListener

    f(Build.VERSION.SDK_INT >10) builder =newAlertDialog.Builder(getActivity(), R.style.Theme.Sherloc ...

  3. java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText

    Caused by: Java.lang.ClassCastException: Android.widget.TextView cannot be cast to android.widget.Ed ...

  4. 安卓出现错误: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText

    Caused by: Java.lang.ClassCastException: Android.widget.TextView cannot be cast to android.widget.Ed ...

  5. 【转】java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;

    最近在配置最新的ssh(struts2.3.16.3+hibernate4.3.7+spring4.1.2)的时候遇到的这个错误提示,后来在网上找了半天都不能解决,虽然有个说法是model对象用这样@ ...

  6. java.lang.NoSuchMethodError: android.view.View.setBackground

    int sdk = android.os.Build.VERSION.SDK_INT; if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) { ...

  7. java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView

    最近在学习drawerLayout时,遇到这个bug.如下示: java.lang.ClassCastException: android.widget.RelativeLayout cannot b ...

  8. java.lang.NoSuchMethodError:android.content.Context.getDrawable

    今天在开发的时候,这个代码在源码中是可以看到的,但是在android 4.3手机上面会报错,具体错误信息和代码如下: setBackgroundDrawable(context.getDrawable ...

  9. 调用android的getColor()方法出现 java.lang.NoSuchMethodError: android.content.res.Resources.getColor

    1.java.lang.NoSuchMethodError: android.content.res.Resources.getDrawable/getColor或者 java.lang.NoSuch ...

随机推荐

  1. Dev之ChartControl控件(二)— 绘制多重坐标图形

    有时针对一个ChartControl控件可能要设置多个Y轴,进行显示: 以下举个例子:如在一个Chart中显示多个指标项如图: 首先,读取数据,并对左边的Y轴最大和最小值进行设定 IndexSerie ...

  2. 查看UDP连接情况

    运行界面,输入"CMD"命令; 在命令提示符界面中,输入"netstat -s -p udp"命令,按回车.即可显示本机所有UDP连接情况.

  3. hdu_5589_Tree(莫队+字典树)

    题目连接:hdu_5589_Tree 题意:给你一棵树和一些边值,n个点n-1条边,一个m,q个询问,每个询问让你输出在[l,r]区间内任意两点树上的路径的边权异或的和大于m的点对数. 题解:这题很巧 ...

  4. Codeforces Round #361 (Div. 2) C.NP-Hard Problem

    题目连接:http://codeforces.com/contest/688/problem/C 题意:给你一些边,问你能否构成一个二分图 题解:二分图:二分图又称作二部图,是图论中的一种特殊模型. ...

  5. 贝塞尔曲线 & CAShapeLayer & Stroke 动画 浅谈

    转载自:http://46aae4d1e2371e4aa769798941cef698.devproxy.yunshipei.com/qiaoqiaoqiao2014/article/details/ ...

  6. Qt5:Qt中图片的翻转,旋转,缩放,扭曲操作

    具体用到了  mirror()  shear()  scaled() translate() rotate() 等函数函数等会儿再写 (其中  translate() 和 rotate() 俩函数组合 ...

  7. mysql 赋给用户权限 grant all privileges on

    遇到了 SQLException: access denied for  @'localhost' (using password: no) 解决办法   grant all privileges o ...

  8. C语言常见命名规范

    C语言常见命名规范   1 常见命名规则 比较著名的命名规则首推匈牙利命名法,这种命名方法是由Microsoft程序员查尔斯·西蒙尼(Charles Simonyi) 提出的.其主要思想是“在变量和函 ...

  9. 省市二级联动--使用app-jquery-cityselect.js插件

    只有省市二级联动,三级联动还没处理好,会尽快完善. 嵌入id: <div class="form-group"> <label>地址</label&g ...

  10. 解决:IE中不能自动选择UTF-8编码的解决方法

    IE中不能自动选择UTF-8编码的解决办法 在windows操作系统上使用IE作为浏览器时.常常会发生这样的问题:在浏览使用UTF-8编码的网页时,浏览器无法自动侦测(即没有设定“自动选择”编码格式时 ...