I’m trying to get my head around Android layout in the context of a ListView and it seems pretty primitive (though it’s entirely possible that I’m Doing It Wrong™), if I wanted to render something simple in a list view consisting of a Name and a Count, something like this:
I’d use this kind of XAML in WP8 / WPF / Silverlight:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Height="*" />
<ColumnDefinition Height="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" x:Name="Thing" />
<TextBlock Grid.Column="1" x:Name="Count" />
</Grid>
However, that doesn’t seem to be possible with Android Layout – I tried using RelativeLayout but it seems as if either one or the other would always be full size and the other would get eaten.
Do you want something like this?
Or you could use a
LinearLayoutand setweights:Or you could use a
GridView, there is a great example on developer.android.com.