开发者

android - draw slope / slant line on a textview

开发者 https://www.devze.com 2023-03-10 11:36 出处:网络
hi, I\'m trying to implement something similar to the image attached. I have two textviews one on top of the other and i want their borders to look like the one in the image. I was able to draw roun

android - draw slope / slant line on a textview

hi, I'm trying to implement something similar to the image attached. I have two textviews one on top of the other and i want their borders to look like the one in the image. I was able to draw rounded开发者_JS百科 corners by setting the cornerradii of the GradientDrawable but i have no clue as in how to draw the slope on the right side of the first textview. Any help on how to do this is much appreciated!! thanks.


I would in this case do the graphics in a some graphics editing program (Photshop, GIMP or Inkscape for example). Two different drawings, one for the top part and one for the bottom. Then convert the drawings to NinePatchDrawable to be used as backgrounds for the text views. Since this type of drawable can be made larger or smaller depending on the length of the text in the TextViews.


You can use a transparent background image instead of drawing the background. Else you can use the canvas.

Edit : bad image example :-)

android - draw slope / slant line on a textview

0

精彩评论

暂无评论...
验证码 换一张
取 消