0

I have made a layout in XML consisting of a LinearLayout having 2 TextViews as its children.

I want to draw a vertical line within the second text view. For that, I created a class and inflated the above XML in its constructor. Now, what methods do I have to override in order to draw the line, and how do I get the Canvas for the text view ?

AstroCB
  • 12,337
  • 20
  • 57
  • 73
Cygnus
  • 3,222
  • 9
  • 35
  • 65

1 Answers1

1

You can Override onDraw(Canvas canvas) method of the TextView (by creating a custom View that extends TextView) to draw the line. A simpler approach is to use RelativeLayout and put an ImageView with transparent background over the 2nd TextView and with the line and set its visibility to visible when you need to draw the line.

Mohamed_AbdAllah
  • 5,311
  • 3
  • 28
  • 47