Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse
2015-02-13 15:42
701 查看
经常打开别人的工程,发现layout里面使用了一些第三方的自定义控件,Graphical Layout标签里是无法预览页面的,抛出一些异常,上图吧:
对于提示Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse。
或者直接抛出的java.lang.NullPointerException,我们直接找到View层的代码,然后 解决方法是定位触发错误代码段,并将造成此错误的代码行用
if(!isInEditMode()){
//造成错误的代码段
}
包起来,这样在Eclipse中显示时将跳过此代码段而不再出现错误。
这样就可以正常预览layout了。
对于提示Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse。
或者直接抛出的java.lang.NullPointerException,我们直接找到View层的代码,然后 解决方法是定位触发错误代码段,并将造成此错误的代码行用
if(!isInEditMode()){
//造成错误的代码段
}
包起来,这样在Eclipse中显示时将跳过此代码段而不再出现错误。
这样就可以正常预览layout了。
相关文章推荐
- 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
- 【Android笔记】引用第三方自定义控件出错: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
- 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 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 or show sample data when shown in the IDE
- TIP: when you get a message in job log user [Dr. Who] is not authorized to view the log
- How to use my view helpers in my ActionMailer views?
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- Easiest way to use Qhull library in your code.
- Using Bytecode Outline to View Java bytecode in Eclipse
- Code view is missing in SharePoint Designer Beta 2 when you try to edit a WSS v3 site.
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- I have a custom view that I want to be able to initialize both in-code and in nib.