I've created a custom view which extends \[code\]RelativeLayout\[/code\], and I want to preview how it looks in the designer.The java is something like this:\[code\]// The view for a snap in the search/browse fragment.public class MyView extends RelativeLayout{ public MyView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); LayoutInflater inflater = LayoutInflater.from(context); inflater.inflate(R.layout.the_layout, this); } public void setData(String text) { mText.setText(text); } // *** Views *** private TextView mText; @Override protected void onFinishInflate() { super.onFinishInflate(); mText = (TextView)findViewById(R.id.text); }}\[/code\]And the XML is like this:\[code\]<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <!-- (And lots more views) --></RelativeLayout>\[/code\]There are a few problems with this however:[*]This actually creates a \[code\]RelativeLayout\[/code\] within a \[code\]RelativeLayout\[/code\] which is pointless. It can be solved by changing the XML \[code\]<RelativeLayout>\[/code\] to a \[code\]<merge>\[/code\] but then I can't preview the layout at all![*]I want to use the \[code\]isInEditor()\[/code\] function (or whatever it is called) in the java to add some sample data for previewing purposes, but I can't find a way to tell the XML editor that it should display a preview of my class instead of the actual XML.One unsatisfying solution I can think of is to create an empty \[code\]preview.xml\[/code\] file with only \[code\]<com.foo.bar.MyView/>\[/code\] in it... But that seems kind of silly. Is there a better way? (I don't really care about editing as much as previewing, since - let's face it - Eclipse/ADT are way too slow and flaky to make graphical layout editing usable.)