B4J Question [B4X] CustomListView with X Columns based on width of Form/Screen ?

Magma

Expert
Licensed User
Longtime User
Let's say for example we have a card (a layout like this):
card1.jpg

a pane... with some labels... may be a an image too....

Is there something (CustomListView) ready to use or I must create it... to show many layouts with X Columns based on width of Form/Screen ?

1647942071342.png


or if it is bigger form... screen:
1647942107002.png


I know that i can may be create 2,3,4 different layouts with 2,3,4 panes and labels...
but thought may be there is a ready routine for customlistview making that...

or not ? :)

is there a ready lib/snippet .. that can i use... ? thanks
 

Magma

Expert
Licensed User
Longtime User
@LucaM's :) create the item at runtime... yes i know with customlistvew... but is only one item per row ?
or not ? ?????

is there any example ?


or you mean have 3 items in a layout and then use it as one item at customlistview per row.... (that i am saying at first post)...
isn't there any ready snippet to do that?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
@LucaM's :) create the item at runtime... yes i know with customlistvew... but is only one item per row ?
or not ? ?????

is there any example ?
I write directly here a poorly intelligent thing.

You will have a basic panel, as large as the CLV.
If you decide that the credit card (your View - ImageView) is N dips wide, calculate how many will fit, create them and add them to that panel. If, on the other hand, you want to establish in advance how many it should contain, do the reverse, divide the width of the panel by the number of ImageViews to create and add.
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
Magna why do you think a financial institution only displays a limited number of numbers and shields your name. Precisely to prevent abuse. Replace your image with this fake card.
 

Attachments

  • external-content.duckduckgo.com.jpg
    external-content.duckduckgo.com.jpg
    59.4 KB · Views: 166
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
The AsyncBitmap example show how to have multiple columns within a single CLV row.

 
Upvote 0

Magma

Expert
Licensed User
Longtime User
Magna why do you think a financial institution only displays a limited number of numbers and shields your name. Precisely to prevent abuse. Replace your image with this fake card.
it is already fake... and is a member card... + is an ad from a printing company ! :)
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
The AsyncBitmap example show how to have multiple columns within a single CLV row.

It has a fixed number of ImageViews / row (4).

(and a strange thing too:
Type MyImageData (IndexOfFirstImage As Int)
?
)
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
So actually.. there isn't something ready that will measure the width of a layout and show 2 or 3... may be more (X) per row... ?

but a way... to sync more than one xclv... or create in runtime/designer layout and show them per row... right ?

Actually this i want is something like DIV (in html)
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
So actually.. there isn't something ready that will measure the width of a layout and show 2 or 3... may be more (X) per row... ?

but a way... to sync more than one xclv... or create in runtime/designer layout and show them per row... right ?

Actually this i want is something like DIV (in html)
That is correct.
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
So actually.. there isn't something ready that will measure the width of a layout and show 2 or 3... may be more (X) per row... ?

but a way... to sync more than one xclv... or create in runtime/designer layout and show them per row... right ?

Actually this i want is something like DIV (in html)
You can use this B4XPages [B4X] BitmapsAsync example as a starting point. It contains a working B4J example where the width of the images scales with the size of the forms. It must be easy to implement a case statement for different form widths.
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
You can use this B4XPages [B4X] BitmapsAsync example as a starting point. It contains a working B4J example where the width of the images scales with the size of the forms. It must be easy to implement a case statement for different form widths.
i will check it now :) thanks
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
If you only want to display the cards and you don't have too many cards, it would be easier to do it straight onto a scrollpane.
 

Attachments

  • Scrollpanelayout.zip
    37.1 KB · Views: 181
Upvote 0

Magma

Expert
Licensed User
Longtime User
@stevel05 This is the result that I want.. but I think that in customlistview will be more manageable (or not?)...
but for sure... this is something that helps me a lot...

Actually one thousand cards not a small number :) (LucaMs must agree)
 
Upvote 0
Top