Text view or something to hold and display large amounts of text

elitistnot

Member
Licensed User
Longtime User
If there a view for holding large amounts of text? Edittext is really not ideal for this and seems to have a limit (whatever it is). I just want to be able to display a large amount of text in a scrollable manner (similar to a word processor or terminal emulator without the the user editing the text though - just viewable text with no input).

I was trying to see if a scrollview would work and literally draw the text to the scrollview1.panel.canvas but what a nightmare to simply display text. I really just want to dump a lot of text into a view and have the user be able to read it and scroll it.

Anyway, I figure there must be an easy way to do this without resorting to drawing text.

Thanks for any help.
 

elitistnot

Member
Licensed User
Longtime User
CustomListview


The customlistview is excellent. I really like it. However, it seems to default to using whatever layout is loaded at the time inside the activity_create sub.

So, if you have a main layout that is a tabhost it runs into problems since the tabhost loads all the other layouts... basically it draws the customlistview on the activity panel behind the tabhost. i.e. the customlistview has activity or something like that as it's parent instead of one of the layouts on the tabhost.

So, trying to figure out how to tell customlistview which layout to use so that it appears on the correct layout for a specific tab on the tabhost. Is there anyway to pass customlistview the name of the layout to use?

==============================
UPDATE
==============================

Ok I got customlistview to work with a tabhost by moving the statements for the customlistview to after the tabhost1.addtab() statemments;

TabHost1.AddTab("Radio Show","layoutradioshow")
TabHost1.AddTab("tab 1","layouttab1")
TabHost1.AddTab("tab 2","layouttab2")
.

clv1.Initialize(clv1, "clv1")

Panelcomments.AddView(clv1.AsView, 0, 0, Panelcomments.Width, Panelcomments.Height)

clv1.DefaultTextBackgroundColor = Colors.Gray


Worked like a charm....

Except, not scrolling for some reason... so now got to figure out why not.

=================
UPDATE
=================

Ok got scrolling working again. So the whole thing works amazingly well. Thanks very very very much for your help.
 
Last edited:
Upvote 0

Informatix

Expert
Licensed User
Longtime User

CustomListView is a B4A class. That means you have the source code at your disposal and you can make any change to suit your needs. But if you don't want to worry with that, you should use the CheckList class instead. It is compatible with TabHosts. Currently, CustomListView has another problem with TabHost (see below) because a TabHost set its child width and height to -1 ("fill my parent"), so you cannot use sv.Width to get the real width of the ScrollView. CheckList doesn't have this problem.

EDIT:
@Erel:
CustomListView cannot compute correctly minHeight (line #100, InsertAtTextItem) in a TabHost because the lbl.width is negative.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…