Creating horizontal and vertical dotted lines in android

前端 未结 9 2211
臣服心动
臣服心动 2021-01-30 17:14

I want to draw horizontal and vertical dotted lines in android using shapes.

I want to draw like this

\"ent

9条回答
  •  感动是毒
    2021-01-30 17:28

    This solution is 100% working and wish help you:

    At first create a drawable which will draw a horizontal dashed line.

    Let dashed line drawable name is horizontal_dashed_line.xml
    
      
      
    
         
      
    

    if you want to have vertical dashed line you have to rotate this drawable by followings:

    Let drawable name is vertical_dashed_line.xml
    
      
      
    
      
    

    Now you have a horizontal and vertical dashed line.

    How to use:

    To draw horizontal line simply add horizontal_dashed_line.xml in your layout. For example:

        
    

    But if you want vertical line, just add vertical_dashed_line.xml instead of horizontal_dashed_line.xml.For example:

        
    

    Good luck!

提交回复
热议问题