Creating a compound view from an XML layout
<p>I'm trying to create a compound control from an XML layout.
This is how I do it:</p>

<pre><code>public class CustomButton extends LinearLayout {

    private TextView title;
    private TextView subTitle;

    public CustomButton(Context context, AttributeSet attrs) {
        super(context, attrs);
        TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.CustomButton, 0, 0);

        String titleStr = a.getString(R.styleable.CustomButton_title);
        String subTitleStr = a.getString(R.styleable.CustomButton_subTitle);
        a.recycle();

        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.custom_button, this, true);

        title = (TextView)findViewById(R.id.title);
        title.setText(titleStr);

        subTitle = (TextView)findViewById(R.id.subtitle);
        subTitle.setText(subTitleStr);

        //invalidate();
        //requestLayout();
    }
}
</code></pre>

<p>If I run in debug mode I see that <code>titleStr</code>, and <code>subTitleStr</code> have the values that I predefined in the XML layout, so I can say for sure that the constructor is called. However the screen appears blank, it does not show anything and I don't have idea why is this so. </p>

<p>Would appreciate if you could help with this issue.</p>

<p>(FYI, I'm following this tutorial: <a href="http://www.vogella.com/articles/AndroidCustomViews/article.html" rel="nofollow">http://www.vogella.com/articles/AndroidCustomViews/article.html</a>)</p>
