Android Tutorial [XUI] CustomListView with floating titles

clv_floatingtitle.gif


Title items are added to the list.
A Panel is set above the list. The panel shows the current title when the top visible item is not a title item.

It works by checking for the top item type. If it is a title item then the panel is hidden, otherwise the panel is shown with the current title.

The title layout should be anchored to the bottom. This allows the same layout to be loaded to the panel and to the cell items.
The panel is slightly taller to compensate for the two dividers.
It is recommended to remove the call to AutoScaleAll. Otherwise the switch between the cell title and the panel title will not be accurate (as the variants sizes are different).

It should be simple to implement the same solution in B4J and B4i.
 

Attachments

  • CLV_FloatingTitle.zip
    9.4 KB · Views: 1,318
Last edited:

love2you

New Member
I have a question.
To refresh the list, some sentences in Activity_Create were moved to sub AAAAA.
And I created Button and tried calling AAAAA from Button1_Click.
It worked well until I pressed the button, but when I pressed the button, only the default value(Title) appears on the floating table.
Do you know how to solve this problem?
I am beginner and I am poor at English. I am very sorry about this.
 

Attachments

  • CLV_FloatingTitle_Question.zip
    12 KB · Views: 532

Mark Stuart

Active Member
Licensed User
Longtime User
Hi,
Any chance 2 floating items can be used in the example, instead of just 1?

Example:
Load clv with 3 row types: year, month, and person - in that order.
The "year" row only consists of a number: the year ie: 2025.
The "month" row only consists of the month name. "Month" rows start with the current month and go for a 12 month period. So the month could start at October 2025 and the last month row data would be September 2026.
The "person" row has name and birthdate.
This row is a part of the month grouping, where any person with a birthdate in that month would be in that month group.

What I need to happen:
After all the data is loaded, the current year (2025) will appear at the top. The next row will be the month (October), and the 3rd and subsequent rows for that year and month will be person rows matching that year and month.
When scrolling, the year and month will stay in place until the next month grouping (November) appears and the October month row is replaced by November. The year row stays in place until November and December are scrolled away. Then 2026 appears with January and the person rows for 2026 and January.

I hope this is not too confusing. If so I'll explain maybe with a mocked image.

So how would this be done with 2 floating items?

Regards,
Mark Stuart
 
Top