Listview problem

179 views
Skip to first unread message

Nuar Alwi

unread,
Jul 24, 2019, 11:04:57 AM7/24/19
to MIT App Inventor Forum
Hello. I have question here.i do a multiple choices question using list view. I want do this command when the button of answer being click if the true answer will turn green and rest will turn red (wrong answer) how to do it
2.how we want to link on buttn with multiple images. The image will come out in ordr?

ABG

unread,
Jul 24, 2019, 11:28:49 AM7/24/19
to MIT App Inventor Forum
You can't color individual ListView Elements.

However, you can hide the ListView and show a HTML Label
with colored lines, like this example ...
to let the quiz taker review his result, then let him ask for the next question
and be shown the ListView again.

Is your question 2 about an Image Picker component?

ABG

TimAI2

unread,
Jul 24, 2019, 11:31:48 AM7/24/19
to mitappinv...@googlegroups.com
1. Something like this:

I set the initial listview elements to Dog,Cat,Pig,Cow, the reload is to hopefully deselect any selection, regardless I set the selection to be the same as the background
The condition is based on index 2 being the correct answer, you will need to build in the logic to make this work for all your questions
Have a play around, see if you can get it just how you want 

listviewcolours.png


2. If you want an image to appear when an item in the list is selected, create a list of images in the same order as the list view, then display the corresponding image


listviewimages.png


EDIT: if you only want to show an image for the correct answer, move the set image block inside the if conditional statement



ABG

unread,
Jul 24, 2019, 12:27:15 PM7/24/19
to MIT App Inventor Forum
I stand corrected by @TimAi2,
you can change the color of the Selected Element
and the other Elements for a total of 2 colors.

You can change the Selected Element to highlight
the correct choice, and you can revise the .Elements
to text JOIN Elements with markers like
 <=== You Chose
 <=== Correct Answer

If you need to go beyond 2 colors, see

ABG

Nuar Alwi

unread,
Jul 25, 2019, 1:08:39 AM7/25/19
to MIT App Inventor Forum
Im doing single screen app for math quiz.all the answers choices will display in listview. When my studnt click the answer choices and the answer is correct the text CORRECT will apears same with wrong answer. I managed to do it.The problem is what i need to do is when the answer is wrong the button "see solution" will apear.student click and the image of solution will appear. When they answer thn nex question this action will repeatig and the image for solution is different for question no 1.PLEASE HELP ME

TimAI2

unread,
Jul 25, 2019, 3:53:13 AM7/25/19
to MIT App Inventor Forum
There are so many different ways to achieve what you want. Here is one method, based roughly upon what you say you want. (I have continued on from my previous example...)

If the user selects the correct answer the corresponding image is displayed.
If the user selects the incorrect answer, a button appears
If the user clicks the button, the button displays the image for the correct answer
If the user clicks the button while the image is displayed, things are reset, and the "procedure" to go to the next question is called

listviewimagesbuttonsolution.png


You will need to modify this for your own needs


Reply all
Reply to author
Forward
0 new messages