CustomListView - A flexible list based on ScrollView

Status
Not open for further replies.

macnlkc

Member
Licensed User
Longtime User
Erel, thanks for all the great help. I am just about finished with the first pass of the application.

I do have one question. How do I highlight a selection in the list once it is touched? The CustomListView class doesn't seem to have support for this capability.

:sign0104:
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You should see an orange highlight when you touch an item:
SS-2012-11-01_09.10.12.png


It will only show when you press on the item background.
 

IanMc

Well-Known Member
Licensed User
Longtime User
Observations and questions

I noticed that when I choose Project > Add Existing Module
it takes a copy of the module and places it in my project folder so I made a new 'Classes' folder in my Basic4Android installation folder so that I have these three now:

Additional Libraries
Classes
Libraries

That way I always know where they are.

I like the CustomListView because based on the ScrollView it shows a little scroll bar which indicates how much stuff you are scrolling through.

It may be a bit overkill for what I want though as I only want to display lines of text, perhaps in different colours but I want a terminal type view like this:

>this is an outgoing line of text
<this is an incoming line of text
>this is another outgoing line of text

etc. So I don't want any dividers or spacing between the lines of text and I'd also like to be able to programmatically force to the bottom, newly added line of text.

This type of view might also be used for a chat client etc.

Would this be easy to accomplish with the CustomListView class?
:sign0104:
 

IanMc

Well-Known Member
Licensed User
Longtime User
Thanks, I changed dividerHeight to 0 and the dividers have gone but there is still a space between each line that corresponds to about 2 lines.

I'd like to have the lines one on top of the other if possible.

Can't immediately see anything obvious, probably has something to do with panel Height.

What would be the best thing to alter to achieve this?
 

IanMc

Well-Known Member
Licensed User
Longtime User
Yes that did it, perfect, thanks!

I do have one more question.

Is it possible to set instances of the CustomListView to be app-wide globals? so that I can add lines of text from other activities?
 
Last edited:

macnlkc

Member
Licensed User
Longtime User
How do you leave an item highlighted that has been selected? Since I use two CustomListView (One master and one slave) I want the master to denote what was touched (thus leave the touched item highlighted). Is this possible? I haven't been able to figure out how to do this yet.
 

IanMc

Well-Known Member
Licensed User
Longtime User
Get CustomListView item or index number

Hi, I'm not sure if this question has already been answered but I have created a CustomListView and populated it with lines of text using clv1.AddTextItem

I can see that each time I press on a line it changes colour, what I need to do is to have a click event so that when I press on a line and it changes colour the click event is called allowing me to get the index of the line pressed, then I should be able to get the content of that line.

Is this easy to accomplish?

PS I've initialised the CustomListView like this:
clv1.Initialize(Me, "clv1")
 
Last edited:

Gunther

Active Member
Licensed User
Longtime User
How to set background to transparent?

Dear Erel,

how and where one can set the backcolor of the list to transparent so that one can see a bitmap added to the activity?

Gunther
 

roarnold

Active Member
Licensed User
Longtime User
Custom List View

Erel, or whomever,

I attempted to utilize the CustomListView given the information I will be using and I get an error that it wants a .jar file. I don't see one. Is it to be implemented a different way?

Thanks,
R
 

zeuspower

Member
Licensed User
Longtime User
:sign0098: as always...

I have a small problem...
I populate the list perfect with the addtextItem

one Item is a phone number,I want to click on it and open the call phone dialog...Ok ,i did it but because i also want a small icon next to the phone number,so i tried for a start to use IN MY CODE the createListItem ...
Think something like a mix with addTextItems -Rows and 1 or 2 rows with
graphics and text

but i get a compile error:

B4X:
Compiling code.       
                  Error
Error compiling program.
Error description: Current declaration does not match previous one.
Previous: {Type=Phone,Rank=0}
Current: {Type=Panel,Rank=0}
Occurred on line: 679
Dim p As Panel

ON THIS LINE :
 Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
   Dim p As Panel
 

mc73

Well-Known Member
Licensed User
Longtime User
Δύναμη Διός, κάπου στον κώδικα σου έχεις δηλώσει μάλλον dim p as phone. Άλλαξε το dim p as panel σε κάποιο άλλον όνομα π.χ. p2.
 
Status
Not open for further replies.
Top