In B4A the border disappear at the level of each item (it seems "sent to back").
I've tried checking both XUI Views library and xCustomListView library (I've not well understood why "CustomListView" view is available also with only XUI View but I'll open another thread for this).
Your solution is immediate but I should insert a Pane/Panel for each of my four clv and to write different code for B4J and B4A. Not a such big issue, in fact, but if I may manage it with less views and less code rows should be better for me.
I'll use your solution in the case working onto clv will not be possible.
Here is an example that will set the border and background for each item at run time:
B4X:
For Each s As String In MyList
Dim pnl As B4XView = xui.CreatePanel("")
pnl.SetLayoutAnimated(0, 0,0, clv1.AsView.Width, 85dip)
pnl.LoadLayout("Item") 'layout has 1 label: LblText
pnl.SetColorAndBorder(xui.Color_DarkGray, 5dip, xui.Color_Green, 5dip) 'THIS IS YOUR NEW LINE
LblText.Text = s
clv1.Add(pnl, s)
Next
Why would you want to do that instead of the individual items. Can you show a screenshot on how it looks like in B4A whether by putting the xClv on a panel or otherwise.
My CustomListView has a fixed height and variable text.
If the text length takes less space than the height of the CustomListView there is no problem: with the ResizeItem function I can set the item with an height equal to CustomListView height. In this case, the item border coincide (more or less) with the CustomListView border.
In the case the text length takes more space than the height of the CustomListView, the item becomes scrollable, the height of the single item will be higher than the height of the CustomListView and the two border will not coincide.
The solution suggested by @mangojack has the problem that if the panel is brought in front of the CustomListView, the item will no more be scrollable; if it is sent back then it is not visible. The solution is to make the pane/panel a little more bigger than the CustomListView: not the best for me.
Post a small project showing the problem.
This would be much easier for helpers, because then, they see what exactly you have done and how and can test it !
My "solution" was based on my impression you had a single CLV with some items .. and suggested the CLV was added TO a Panel , enabling a border to be displayed.
So I'm slightly lost now what you are trying to do at the moment.
I made quite some tests with a specific test project to understand what is behind the scene.
I am afraid that you cannot easily do what you want in B4A with an xCustomListView.
The behavior of a B4A ScrollView is different from a ScrollPane in B4J, xCustomListView is based on those
And the structure of the xCustomListView is also more complex with its different layers.
My suggestion is to use for each item a Panel / Pane for the background and EditText / TextArea for the text.
The EditText / TextArea views scroll the text automatically when the text height becomes higher than the view, so no need to adjust any height.
Attached my B4A test project, it is easy to adapt it to B4J.
It contains for comparison:
1 ScrollView as ScrollView
1 ScrollView as B4XView
1 xCustomListView
1 Panel / EditText combination, the EditText has a None text input type.
And a Button to change the text and colors.
The Panel / EditText combination could also be made as a CustomView.
My "solution" was based on my impression you had a single CLV with some items .. and suggested the CLV was added TO a Panel , enabling a border to be displayed.
This simple thing (adding clv TO a panel) arrived later in my mind, being concentrated on the border... so, the first think was set visibility of a panel with the border already set instead of use the panel in the appropriate way. Then: instead to keep easy, I took complicated way.