Nirmal Patel
Nirmal Patel

Reputation: 5168

Alloy ListView with static Header

Is it possible to make the ListView's HeaderView static such that it does not scroll off?

<ListView id="agreementListView" onItemclick = "itemClickAgrmt" class="elementsList" defaultItemTemplate="finAgreement" >
    <HeaderView>
        <View class="row" >
            <Label class="lblAgr col1">Finance</Label>
            <Label class="lblAgr col2">Duration</Label>
            <Label class="lblAgr col3">Monthly</Label>
            <Label class="lblAgr col4">Down</Label>
        </View>
    </HeaderView>
    <Templates>

This HeaderView shows up like another row at the top that scrolls away.

Upvotes: 1

Views: 490

Answers (2)

Thomas Lemaitre
Thomas Lemaitre

Reputation: 1154

No, you can't. The HeaderView is stick with the ListView and scroll with it. If you want a static view, just add a view before the ListView on top of it.

Upvotes: 4

Prashant Saini
Prashant Saini

Reputation: 3539

For anyone who comes to this question, here's the summary to handle the HeaderView scrolling.

On iOS:

  • Putting the HeaderView inside the ListSection will always make it stick to the top until next header-view comes up.
  • Putting the HeaderView right inside the ListView (not the ListSection) will always scroll it along with the ListItems and won't receive the onItemclick event.

On Android:

  • HeaderView will always scroll wherever it is put.

Upvotes: 0

Related Questions