Change ListView colors

363 views
Skip to first unread message

Michael W.

unread,
Jun 13, 2018, 4:26:19 AM6/13/18
to MIT App Inventor Forum
Hello,

I have a LISTPICKER of which I fill in a ListView after an "afterpicking." This works so far. Also I know how to change the "TextColor", "BackColor" of the ListView.
My question would be:
a) Is it possible to give individual rows in a ListView a different color?
b) to provide elements of a ListView / series with a different color? For example:
The text in a ListView series would be "hello my name is Michael"!
  Now I want the "hello" in black, "name" in red, and Michael in "green"!
Is this possible in a ListView or can only the entire ListView (Text and BackColor) be given a different color?
I have added my text block to the ListView and LIStPICKER so that you can see how far I have been so far.

thank you for your help
Michael
blocks.jpg

TimAI2

unread,
Jun 13, 2018, 9:44:53 AM6/13/18
to MIT App Inventor Forum
a) as far as I know, you can only have the one colour
b) this is possible, you will have to deconstruct your string and code it accordingly. see below for examples from SteveJG

Chris Ward

unread,
Jun 13, 2018, 10:25:07 AM6/13/18
to MIT App Inventor Forum
Hello Michael

You could instead make an HTML list and display it in a WebView component - with that, you can do practically anything with colours.

Abraham Getzler

unread,
Jun 13, 2018, 1:24:28 PM6/13/18
to MIT App Inventor Forum
You can build your own List View using buttons ...

For faster scrolling, use a thin vertical Canvas and a Ball.

ABG

Michael W.

unread,
Jun 14, 2018, 1:19:51 PM6/14/18
to MIT App Inventor Forum
Hello;

I've been trying to put some color into my ListView all day, but unfortunately I'm a beginner in AI2, just trying it out. I just can not manage it! I added the BLOCKs I tried with. Maybe someone can tell me whats happend ?
I was able to solve all the other problems - through lots of tasting and experience, but here ....

Michael
blocks.jpg
Unbenannt-2.jpg

Abraham Getzler

unread,
Jun 14, 2018, 1:38:13 PM6/14/18
to MIT App Inventor Forum
post the .aia ?
ABG

Michael W.

unread,
Jun 14, 2018, 1:46:05 PM6/14/18
to MIT App Inventor Forum
I found the mistake! The list is now displayed in the listview, but the entries <big> <b> are also output. So the text is not "bold"!!!
I can add the aia tomorrow. I have to solve the problem from my APP ;-) since the APP is already very extensive and you do not know where the error is exactly!
I have add the "working blocks", maybe it helps a little

Michael
blocks.jpg

TimAI2

unread,
Jun 14, 2018, 1:51:47 PM6/14/18
to MIT App Inventor Forum
Sorry, my link and comments were a bit misleading, you cannot do what you are trying to do. Best to look at html/javascript table

Abraham Getzler

unread,
Jun 14, 2018, 2:34:48 PM6/14/18
to MIT App Inventor Forum
 you cannot do what you are trying to do. Best to look at html/javascript table

Ditto

ABG
 

Michael W.

unread,
Jun 16, 2018, 12:59:14 AM6/16/18
to MIT App Inventor Forum
I solved the problem! I used the "ListView" of Cllin Tree. - Collin Tree ListviewI
Thanks anyway for your help

Michael
Reply all
Reply to author
Forward
0 new messages