I come from the world of GWT and UIBinder, where I am used to defining custom components by expanding Composite and then putting all the UI layout code in MyComponent.ui.xml. This is a very good way to create components from smaller parts.
I am trying to achieve the same effect on Android with custom views. I was able to programmatically expand Viewand then add objects by calling addView(textView). I would like to be able to do this in XML, but I do not see how to associate the xml layout file with the view (except for the main file res/layout/main.xml, which provides the main layout for the application.
How can I put my own views in XML?
Edit: My question was unclear. What I want to do is link the file my_widget.xmlto my customized view. Then in my_widget.xml I would like to define various TextViews, etc. And connect them to the View class.
source
share