1

How can I draw a line it may be horizontal or vertical in an ANDROID Activity in Run time
Can any one say how to do this . . . .
Thanks in advance.

Angel
  • 902
  • 8
  • 16
user3251646
  • 278
  • 4
  • 15
  • 1
    you can see here [link][1] and [here][2] [1]: http://stackoverflow.com/questions/3616676/how-to-draw-a-line-in-android/12987068#12987068 [2]: http://stackoverflow.com/questions/12990244/drawing-a-line-with-canvas-from-an-activity – rajshree Feb 04 '14 at 04:43
  • post what you did for the same – Biraj Zalavadia Feb 04 '14 at 04:49

2 Answers2

0

For horizontal:

create a view tag() in the xml layout with width = "match_parent" and height="1dpi"

For vertical:

create a view tag() in the xml layout with height= "match_parent" and width="1dpi"

Don't forget to set background color

If u want to hide it and then show it from java, like on click of a button or something then set its visibility to invisible with android:visibility attribute , and then get this view by id in the java class and set its visibility to visible by myView.setVisibility(view.VISIBLE);

GrIsHu
  • 29,068
  • 10
  • 64
  • 102
Minhaj Arfin
  • 1,021
  • 9
  • 8
0

Hope this is what you are looking for.please have a look on the following link: http://androidgenuine.com/?tag=canvas-draw-line-android

Pihu
  • 1,041
  • 11
  • 35