0

I'm doing a multiple choice quiz app. It has 4 radio buttons. What I want to have is have 3 icons -> No answer yet, right answer, wrong answer. So before any choice is clicked, all are non-answer, when an answer is clicked, if it is right, it light up green, if wrong - light up red. Is it possible to do with radio buttons? Or do I have to find another way out? Like using an ImageView?

Alexey
  • 3,607
  • 8
  • 34
  • 54
  • For my point of view Yes it's possible to do that with radio button. You have to customize radio Button styles and put it in you app.. – Dhruv Jun 29 '13 at 05:15
  • 1
    But you can only have Checked and notChecked states, so only two images. The onPressed states cannot be set, only executed. – Alexey Jun 29 '13 at 05:16
  • Check my answer. I hop its helpful to you. – Dhruv Jun 29 '13 at 05:25
  • @Alexey can you post some code so that i can know it more clearly? – TheFlash Jun 29 '13 at 05:26

2 Answers2

0

Take a look On this Answer.

But u want verification for selected answer. I recognized to u that..Use ImageButton with TextView in your xml file Instead Of RadioButton.Initially Set notChecked image as background of ImageButtons .when User click on Any of your ImageButton. U can verify it On its OnClick event that is it r8 answer or not and then u can set Checked image(red/green) as background image of selected ImageButton.

Community
  • 1
  • 1
Bhoomika Brahmbhatt
  • 7,404
  • 3
  • 29
  • 44
  • Same thing, it only has two static states - Checked and notChecked. I can't make it hold in the onPressed state. – Alexey Jun 29 '13 at 05:18
0

Create one XML in "drawable" folder "radio.xml"

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

      <item android:drawable="@drawable/radio_on" android:state_checked="true"/>
      <item android:drawable="@drawable/radio_off" android:state_checked="false"/>

</selector>
Dhruv
  • 1,862
  • 3
  • 20
  • 38