0

I have to design a layout that contains radio buttons are aligned in vertical pattern and attached with a vertical line. Each radio button is checked, with different color. Below picture will illustrate the design.

https://i.stack.imgur.com/lMxvV.jpg

Anyone can guide me how can I achieve this design.

Thanks and Regards Hasnain Ahmad

bunbun
  • 2,595
  • 3
  • 34
  • 52
hasnain_ahmad
  • 325
  • 6
  • 17

1 Answers1

2

What you can do is a ListView: developer.android.com/guide/topics/ui/layout/listview.html A fairly recent tutorial is listed here: http://www.vogella.com/tutorials/AndroidListView/article.html

  1. On each list item, add a radio button on the left. Android: Radio button in custom list view
  2. Add a custom background on each list item, which includes a line on the left side as you have specified. The line should align with your radio button. ListView item background via custom selector
  3. Finally, remove the line separators between each list item by making them White or transparent. How to change color of Android ListView separator line?

This will give the list the look you wanted.

Community
  • 1
  • 1
bunbun
  • 2,595
  • 3
  • 34
  • 52
  • This answer is a good one but you could add just enough code to put @hasnain_ahmad in the good way. – WannaGetHigh Jun 22 '15 at 09:13
  • @WannaGetHigh Thanks! And sure thing, but instead of reinventing the wheel, I will add links to answers (with the highest ratings I can find) to each part specifically – bunbun Jun 22 '15 at 09:15
  • @bernlim i am new to android, can you refer me to some tutorial or article so i can read it. – hasnain_ahmad Jun 22 '15 at 09:22
  • @hasnain_ahmad yes I have added a bunch of links above. Welcome to StackOverflow. If this helped you, please click the tick. It will increase your credibility too. – bunbun Jun 22 '15 at 09:25
  • GG everything is here, @hasnain_ahmad you now have all the cards you need to develop your layout. – WannaGetHigh Jun 22 '15 at 09:31
  • @WannaGetHigh This is the long learning process to achieve the desired output. I have no idea, did these cards are enough for me, that are mentioned by the "bernlim". – hasnain_ahmad Jun 22 '15 at 09:35
  • @hasnain_ahmad Well I could spend the time writing up an exact solution, which you can then just copy and paste. But then you will hit another basic problem, and come back here to ask again. And again. You have to write it yourself in order to understand the system. Tutorials are aplenty, such as the one I have provided you. :) – bunbun Jun 22 '15 at 09:38
  • @bernlim yes you are right, i will continue to learn step by step. But now i am in trouble. – hasnain_ahmad Jun 22 '15 at 09:44
  • @hasnain_ahmad please expand your question if you are still in trouble and the resources provided are not sufficient – bunbun Jun 22 '15 at 09:47
  • @bernlim dear i will follow the article and question, then i will contact with you for further help. Thanks for you help. – hasnain_ahmad Jun 22 '15 at 09:50