1

I have a custom view extends RelativeLayout. I know I can modify it's children in the java code, but is that possible in xml too? I want to have something like that in my main.xml:

<MyCustomView>
   <SomeControl />
   <AnotherControl />
</MyCustomView>
<MyCustomView>
   <NewControl />
</MyCustomView>

Can you give me hints how to achieve that? Thank you for your help!

ShadowMare
  • 2,087
  • 2
  • 25
  • 27

1 Answers1

1

You may find some explanations here : http://developer.android.com/guide/topics/ui/custom-components.html

You can actually use your custom components in any layout XML file, using the fully qualified name of your class:

<com.package.MyClass id="@+id/my_id" ...>
      ...
</com.package.MyClass>
sdabet
  • 18,360
  • 11
  • 89
  • 158
  • 1
    Thank you for your replies. Using my cutom control in the xml is not a problem but filling it with some other conrtols turns out to be complicated for me. If I do then it is not showing up at all. Sorry for the formatting, I'll fix it when I'm not on my mobile device. – ShadowMare Jan 17 '11 at 14:30
  • @ShadowMare did this response answer your question? I'm trying to do something similar, and I've read the link fiddler supplied but it doesn't cover the use case. As this site is supposed to be aggregating useful information, it's not helpful to mark answers as correct if they're not - if they were helpful, upvote it. – ataulm Dec 24 '12 at 23:52