This works for me. I hope it works for you if nobody can give you a simpler and a more obvious solution.
B4X:
Sub B4XTable1_DataUpdated
For row = 0 To B4XTable1.VisibleRowIds.Size - 1
For Each col As B4XTableColumn In B4XTable1.Columns
Dim pnl As B4XView = col.CellsLayouts.Get(row)
If row = 0 Then
pnl.SetColorAndBorder(xui.Color_Gray, 0dip, xui.Color_Transparent, 0dip)
Else
Dim background As Int = IIf(row Mod 2 = 0, B4XTable1.EvenRowColor, B4XTable1.OddRowColor)
pnl.SetColorAndBorder(background, 0dip, xui.Color_transparent, 0dip)
End If
Next
Next
End Sub
This works for me. I hope it works for you if nobody can give you a simpler and a more obvious solution.
B4X:
Sub B4XTable1_DataUpdated
For row = 0 To B4XTable1.VisibleRowIds.Size - 1
For Each col As B4XTableColumn In B4XTable1.Columns
Dim pnl As B4XView = col.CellsLayouts.Get(row)
If row = 0 Then
pnl.SetColorAndBorder(xui.Color_Gray, 0dip, xui.Color_Transparent, 0dip)
Else
Dim background As Int = IIf(row Mod 2 = 0, B4XTable1.EvenRowColor, B4XTable1.OddRowColor)
pnl.SetColorAndBorder(background, 0dip, xui.Color_transparent, 0dip)
End If
Next
Next
End Sub
If I don't set the column's width, the thin lines appear.
If I set something like 150dip, the line does not appear. If I change the column width to 180dip, the line appears.
In another table, if I don't set the column's width, the thin lines does not appear.
I think this is issue with OS deal with resolutions.
When I tried change the resolution to low settings such as 1024x768, the lines are not visible.
Windows 11 is really buggy.
I forgot that you are working in B4J environment. Here is an extensive testing in B4J. It seems to be working as desired. No gridlines on the header and no gridlines in data rows. Please do me a favor and test it in your B4J even if you decide to abandon the idea:
Place this code after you define the columns:
B4X:
For Each col As B4XTableColumn In B4XTable1.Columns
Dim pnl As B4XView = col.CellsLayouts.Get(0)
pnl.SetColorAndBorder(xui.Color_Gray, 0dip, xui.Color_Transparent, 0dip)
Next
B4X:
Sub B4XTable1_DataUpdated
For row = 0 To B4XTable1.VisibleRowIds.Size - 1
For Each col As B4XTableColumn In B4XTable1.Columns
Dim pnl As B4XView = col.CellsLayouts.Get(row+1)
Dim background As Int = IIf(row Mod 2 = 0, B4XTable1.EvenRowColor, B4XTable1.OddRowColor)
pnl.SetColorAndBorder(background, 0dip, xui.Color_transparent, 0dip)
Next
Next
End Sub
I forgot that you are working in B4J environment. Here is an extensive testing in B4J. It seems to be working as desired. No gridlines on the header and no gridlines in data rows. Please do me a favor and test it in your B4J even if you decide to abandon the idea:
Place this code after you define the columns:
B4X:
For Each col As B4XTableColumn In B4XTable1.Columns
Dim pnl As B4XView = col.CellsLayouts.Get(0)
pnl.SetColorAndBorder(xui.Color_Gray, 0dip, xui.Color_Transparent, 0dip)
Next
B4X:
Sub B4XTable1_DataUpdated
For row = 0 To B4XTable1.VisibleRowIds.Size - 1
For Each col As B4XTableColumn In B4XTable1.Columns
Dim pnl As B4XView = col.CellsLayouts.Get(row+1)
Dim background As Int = IIf(row Mod 2 = 0, B4XTable1.EvenRowColor, B4XTable1.OddRowColor)
pnl.SetColorAndBorder(background, 0dip, xui.Color_transparent, 0dip)
Next
Next
End Sub
I have tested your code above. It seems the behaviour is the same.
I believe this happen in my Windows with wide screen display and high resolution (1920 x 1080).
One way to find out is if you export a small project without disclosing sensitive data that shows the problem on your computer and we can test it for you with the code I posted in post #10. I have tested it extensively in B4J and B4A and with several databases and apps. It worked the way it is supposed to every time. I even tested it with a table that has 11 columns.
One way to find out is if you export a small project without disclosing sensitive data that shows the problem on your computer and we can test it for you with the code I posted in post #10. I have tested it extensively in B4J and B4A and with several databases and apps. It worked the way it is supposed to every time. I even tested it with a table that has 11 columns.
Yes, tested on these resolutions on PC 1920x1080 and also 1289x1024. I also tested it on a samsung phone with: 2280x1080. Worked fine. That is why you need to export a sample project so members can test it for you at whatever resolution they have. If you can't, good luck.
Yes, tested on these resolutions on PC 1920x1080 and also 1289x1024. I also tested it on a samsung phone with: 2280x1080. Worked fine. That is why you need to export a sample project so members can test it for you at whatever resolution they have. If you can't, good luck. View attachment 142814
On "old" Android 8.1.0 API level 27:
The grid lines show up!
On "old" Windows 10 version 1511:
The grid lines do NOT show up! (even after resizing)
Maybe this is OS related... or Java related... or ???
I added some code to your project. Here is attached the B4X project. You can run it in either B4A ( tested on OS 8.1 and OS 11) or B4J ( tested on a PC). The code removes all gridlines. All works for me as expected. This is as far as I am going with this. If that is not what you want, just toss it.