B4A Library ListView supporting RichStrings

Another small lib I want to share.

The only feature is called ListView2 which acts like an normal ListView (from Core) but supports a CharSequence for all labels.
So can use normal Strings as text or RichStrings for more color and formats.


specci48
 

Attachments

  • SPListView_V1.00.zip
    23.6 KB · Views: 1,518

raphael75

Active Member
Licensed User
Longtime User
The only feature is called ListView2 which acts like an normal ListView (from Core) but supports a CharSequence for all labels.
So can use normal Strings as text or RichStrings for more color and formats

Thank you for this library. Do you have a code example showing how you use it?
 

mjtaryan

Active Member
Licensed User
Longtime User
Another small lib I want to share.

The only feature is called ListView2 which acts like an normal ListView (from Core) but supports a CharSequence for all labels.
So can use normal Strings as text or RichStrings for more color and formats.


specci48

I have encountered a problem with ListView2 that I'very not experienced with ListView from Core. In a ListView2 that needs to be scrolled, the least 1 to 3 items in the list do not come into view when scrolling. Any ideas why and a solution or workaround? I've tried adding some blank items at the end, but that doesn't always work. Thanks
 

Sub7

Active Member
Licensed User
Longtime User
I'm using this lib with richstring but i have a problem:

ListView1.TwoLinesLayout.ItemHeight = 200dip - Does not works
ListView1.AddTwoLinesAndBitmap("Hey", "you", icon)

ListView1.SingleLineLayout.ItemHeight = 200dip - Works
ListView1.AddSingleLine("Hey")

Ty
 

eps

Expert
Licensed User
Longtime User
I'm using this lib with richstring but i have a problem:

ListView1.TwoLinesLayout.ItemHeight = 200dip - Does not works
ListView1.AddTwoLinesAndBitmap("Hey", "you", icon)

ListView1.SingleLineLayout.ItemHeight = 200dip - Works
ListView1.AddSingleLine("Hey")

Ty

Do you not need to indicate the Label that you are setting the height of?

Something like :

B4X:
ListView1.TwoLinesLayout.Label.Height = 22dip

ListView1.TwoLinesLayout.SecondLabel.Height = 20dip

HTH
 

Sub7

Active Member
Licensed User
Longtime User
Do you not need to indicate the Label that you are setting the height of?

Something like :

B4X:
ListView1.TwoLinesLayout.Label.Height = 22dip

ListView1.TwoLinesLayout.SecondLabel.Height = 20dip

HTH
Hi eps, I tried that before but without success!

B4X:
ListView1.TwoLinesLayout.ItemHeight = 200dip
ListView1.TwoLinesLayout.Label.Height = 100dip
ListView1.TwoLinesLayout.SecondLabel.Height = 100dip
ListView1.ScrollingBackgroundColor = Colors.black
ListView1.Color = Colors.Black
ListView1.AddTwoLinesAndBitmap(header, eventinfo, defaulticon)
 
Last edited:

brunnlechner

Member
Licensed User
Longtime User
Hallo,
is it possible to integrate RichStrings for more color and formats in a other ListView like MListView?

Thank You
Franz
 

specci48

Well-Known Member
Licensed User
Longtime User
Hallo,
is it possible to integrate RichStrings for more color and formats in a other ListView like MListView?

It should be possible but this question must be answered by icefairy33, the owner of the mListView library.
Maybe he adds the RichStrings support for his library if you ask him.

Specci48
 

TheWind777

Active Member
Licensed User
Longtime User
Another small lib I want to share.

The only feature is called ListView2 which acts like an normal ListView (from Core) but supports a CharSequence for all labels.
So can use normal Strings as text or RichStrings for more color and formats.


specci48

I have had extreme problems with my program crashing with Fatal Signal 11 and Error 7 just at the end of the 'End Sub' when I have a subroutine such as this:

B4X:
sub Globals
 Dim lvMenus As ListView2
end sub

sub Activity_Create
 lvMenus.Initialize("lvMenus")
end sub

Sub lvMenus_ItemClick(Position As Int, Value As Object)
 
 lvMenus.Visible = False
 CallSubDelayed2("", "Do_Menu_Item", Position)
 
End Sub

The crash is random; doesn't always occur. When iz change them from ListView2 to ListView the crash goes away (and, unfortunately, the RichString colors also go away... oh well).

The ListView is populated with lines of text which form a menu of choices which you click-on. Once the user has clicked on it, the function number is sent via Position to the lvMenus_ItemClick() rountine and then on to a 'Menu Choice' routine which handles the menu choice subs.

I would suspect that your ListView2 is closing something; but it doesn't close fast-enough, or something?

Any idea how to get around the problem? I could just throw away the idea of having colored menu items... but they look so nice. Works perfectly except when it crashes.

Every had anybody complain that they were getting Fatal Signal 11 errors from the library, sometimes? I can absolutely say without a doubt that it is the library which is doing it because whenever I change it to ListView instead of ListView2 the problem goes away (and when I use ListView2 it can crash about 1 out of 3 times).

Is there something I could delay doing somewhere? I could either set a flag to wait or do a timer that wastes some time... but the crash seems to occur after the End Sub occurs, not before; which I have no control over.
 
Top