I’ve created a simple compound control containing an EditText and a Button underneath it, that clears whatever text is on the EditText view.
Everything works fine, but what i want to do is view this compound control as a whole (or single view) in hierarchy viewer, but whenever i load this, i see my custom control (which extends LinearLayout), and also the two sub views it contains.
I know its possible to do what i want because i have seen it in the Gmail application, which uses a custom view (CanvasConversationHeaderView) to display email items inside the ListView.
I need to do this because in my case my custom compound control contains a lot more single views than this example so i need to decrease the number of total views in my activity.
I hope someone can help me as to how to accomplish this.
How do you know
CanvasConversationHeaderViewfrom gmail is a compound view?If by compound view you are refering to
ViewGroup, then that’s how hierarchyviewer works, it traverses the tree treatingViewGroupas internal nodes andViewas leafs. If you don’t want this behaviour then don’t extend fromViewGroup(LinearLayoutin this case).