-7

I want to create below layout in XML. I am able to create circle but I don't know how to connect them by a horizontal line:

enter image description here

N J
  • 25,967
  • 13
  • 73
  • 94
user3154663
  • 291
  • 2
  • 18

2 Answers2

1

You can do it by using LinearLayout

<LinearLayout
.......
......>
       <CircleView..../>
       <View 
          android:layout_width="50dp"
          android:layout_height="2dp"
          android:background="@color/circle_color"/>
       <CircleView..../>

       <View 
          android:layout_width="50dp"
          android:layout_height="2dp"
          android:background="@color/circle_color"/>

       <CircleView..../>


</LinearLayout>
N J
  • 25,967
  • 13
  • 73
  • 94
  • Can you give some more piece of code for clarity – user3154663 Sep 09 '15 at 10:45
  • you can create circle drawable for normal and selected view take checkbox instead of CircleView apply selector to checkbox, sma you can do to line selector – N J Sep 09 '15 at 10:52
0

Generally these (step-by-step) indicators are implemented using different images loaded via single ImageView. Just load the appropriate drawable for a particular step. This way you need not worry about writing/arranging lot of UI widgets in xml.

I am attaching sample images for your reference:

step 1 of 4: enter image description here

step 2 of 4: enter image description here

step 3 of 4: enter image description here

step 4 of 4: enter image description here

Gagan
  • 1,467
  • 1
  • 12
  • 26
  • Can i do this by xml without using images? – user3154663 Sep 09 '15 at 10:31
  • You surely can but you will have to write quite a lot views for that (5 views for a 3 step process) and arranging those horizontal connectors between the circular views will take some time. Moreover, if you choose to change the layout in future then it will be a complete rework. :) – Gagan Sep 09 '15 at 10:36