Search code examples
androidxmlchildren

Define children in a view


I have following XML code:

<ScrollView>
    <TextView />
    <TextView />
    <TextView />
    <Button />
</ScrollView>

Is it possible to give all the children of my ScrollView automatically the attribute "android:minHeight=XY"? The best solution would be an attribute for ScrollView but I think I have to write some java code for that, haven't I?


Solution

  • You'll need android:layout_width and android:layout_height in any case for all your Views. Only way you can avoid this, would be by defining a style and apply that style to all your TextViews and Button.