I've created a custom ViewGroup that contains arbitrary child Views and it is expected to populate them. It needs to know the ids of it's children, so I defined an array of ids in arrays.xml and I'm passing that array as an attribute to my custom group, like this:
my_layout.xml:
<com.example.MyLayout
...
custom:children="@array/four_children">
<TextView ...
android:id="@+id.child1" />
<TextView ...
android:id="@+id.child2" />
<TextView ...
android:id="@+id.child3" />
<TextView ...
android:id="@+id.child4" />
</com.example.MyLayout>
arrays.xml:
<array name="four_children">
<item>@id/child1</item>
<item>@id/child2</item>
<item>@id/child3</item>
<item>@id/child4</item>
</array>
I chose this approach because one of the design goals was to define the layouts entirely in xml.
Basically my question is, is using an array of View ids like this an anti-pattern or otherwise dangerous?