How to use isInEditMode() to see layout with custom View in the editor

Problem:
I must edit a software that have a custom view, when I try to edit layout xml, Eclipse says me:

Use View.isInEditMode() in your custom views to skip code when shown in Eclipse

But I have no idea about how and where I must use isInEditMode() in the app

Solutions:
isInEditMode()should be used inside the Custom View constructor. Try the following code:

 public class GraphView extends View implements Grapher { 

         public GraphView(Context context, AttributeSet attrs) {
                super(context, attrs);
                if(!isInEditMode())
                 init(context);
            } 

            public GraphView(Context context) {
                super(context);
               if(!isInEditMode()){
                touchHandler = new TouchHandler(this);
                init(context);
              } 
            } 

你可能感兴趣的:(android,editor,custom,customview)