Android Question b4xtable - autosize

voxel

Member
Licensed User
Hi,
I have a b4xtable (with 4 differently sized columns) and I would like its width to adapt to the width of different screen sizes. Because currently, the table is more or less wide depending on the screens.
The anchors of the table are well set in width and height.
Thanks for your help.
 

toby

Well-Known Member
Licensed User
Longtime User
Use percentage of device width x as shown below
B4X:
FlagsColumn = B4XTable1.AddColumn("Flags", B4XTable1.COLUMN_TYPE_TEXT)
    FlagsColumn.Width = 30%x '30% of device width
    FlagsColumn.Searchable = False
    FlagsColumn.Sortable = False
    B4XTable1.RowHeight = 60dip
    B4XTable1.AddColumn("Id", B4XTable1.COLUMN_TYPE_NUMBERS).Width = 20%x
    B4XTable1.AddColumn("Name", B4XTable1.COLUMN_TYPE_TEXT).Width=30%x
    B4XTable1.AddColumn("Alpha2", B4XTable1.COLUMN_TYPE_TEXT).Width =20%x
    clmHidden=B4XTable1.AddColumn("Alpha3", B4XTable1.COLUMN_TYPE_TEXT)
    B4XTable1.VisibleColumns.RemoveAt(B4XTable1.VisibleColumns.IndexOf(clmHidden))
 
Upvote 0

toby

Well-Known Member
Licensed User
Longtime User
The above code shows 4 columns fitting nicely the screen width (30%+20%+30%+20%=100%)
 
Upvote 0
Top