Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
来源:互联网 发布:淘宝店铺资质25000元 编辑:程序博客网 时间:2024/04/28 05:49
今天 在群里有朋友问到,为什么layout xml 在IDE预览模式下会报出异常,比如java.lang.NullPoninterException
这种特别是在使用第三方的自定义控件情况下出现。
标题正是IDE提示给出的解决方案,Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
那我们就找到JAVA View的代码,找到触发错误代码段,将造成此错误的代码
if(!isInEditMode()){
//do something
//造成 error code
}
在IDE中显示时将跳过此代码段而不再出现错误。
就可以正常预览layout了。
0 0
- Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
- Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
- Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
- Use View.isInEditMode() in your custom views to skip code when shown in Eclipse
- Use View.isInEditMode() in your custom views to skip code when shown in Eclipse
- Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse
- Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse
- Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse
- Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse
- Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse
- 使用eclipse编程出现Use View.isInEditMode() in your custom views to skip code when shown in Eclipse解决方法
- 自定义控件时Use View.isInEditMode() in your custom views to skip code when shown in Eclipse问题
- How to use isInEditMode() to see layout with custom View in the editor
- When to use Delegation, Notification, or Observation in iOS
- How to use another indicator in your code?
- Use Weka in your Java code
- Use WEKA in your Java code
- how to use the code in ms ssrs
- 使用 awk 命令行快速分析 accesslog访问日志
- 白话空间统计十七:聚类和异常值分析(Anselin Local Moran's I)
- 矩阵快速幂
- js 判断两个标准时间是不是同一周
- codeforces round 319 div2 题解
- Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
- 利用RecyclerView实现瀑布流效果
- 深度学习关键词之—过拟合
- Ural 1091 Tmutarakan Exams (水题 容斥+ 莫比乌斯反演)
- linux中配置phpcms v9 中的sphinx
- Inventor API代码性能优化 - 2
- 按序取出一列表格数据
- iOS时间那点事
- 微信端分享接口