Wrapping a LinearLayout from xml
<p>I'm trying to make some Android view classes (which are just wrappers around layouts defined in an XML file). Is this correct:</p>

<pre><code>public class MyViewWrapper extends LinearLayout {
    private TextView mTextView;

    public MyViewWrapper(Context context) {
        super(context);
    }

    public constructUI() {
        LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.myview, this);

        mTextView = (TextView)findViewById(R.id.myview_textview);
    }
}
</code></pre>

<p>so the idea is just that I can construct my views like that, and they have logic inside for modifying their child views etc. The layout looks like:</p>

<pre><code>&lt;LinearLayout&gt;
   &lt;TextView /&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>It just looks like I'm going to get an extra unnecessary LinearLayout. The wrapper class is itself a LinearLayout, and then it will attach the inner LinearLayout from the xml file.</p>

<p>Is that ok?</p>

<p>Thanks</p>
