1

I want to make one application which contains multiple choice question. Each question has three option. I want to show that option with one background image. And also want to change the color of that image randomly for each question. How can i do that?

It is possible to create list view by putting differnt background image for each row?

Result.xml

<LinearLayout
     android:id="@+id/linearlayoutans"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignParentBottom="true"
     android:layout_marginBottom="30dp"
     android:layout_toLeftOf="@+id/chrono"
     android:orientation="horizontal" >

     <TextView
         android:id="@+id/txt_ans_true"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_margin="10dp"
         android:background="@drawable/ic_launcher"
         android:gravity="center"
         android:textColor="#000000" />

     <TextView
         android:id="@+id/txt_ans_1"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_margin="10dp"
         android:background="@drawable/ic_launcher"
         android:gravity="center"
         android:textColor="#000000" />

     <TextView
         android:id="@+id/txt_ans_2"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_margin="10dp"
         android:background="@drawable/ic_launcher"
         android:gravity="center"
         android:textColor="#000000" />
 </LinearLayout>
4
  • 1
    You really ought to research and try a little first. Ideally post a snippet of code you tried. Commented Mar 29, 2013 at 5:11
  • 1
    yes by extending imageview you can create customized imageview, Also it is also possible different row color for each rows. Commented Mar 29, 2013 at 5:15
  • @donfede Right now i tried this by taking three text view with background image. Commented Mar 29, 2013 at 5:24
  • @donfede I have added my code. In this three text view i am getting threee option. Commented Mar 29, 2013 at 5:29

1 Answer 1

2

It is possible to create list view by putting differnt background image for each row?

Yes. Take a look at articles on the internet that back a listview with a custom adapter and a custom view. This is done from the getView() method and there is no shortage of examples / tutorials out there.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.