Vertical (rotated) label in Android

后端 未结 10 971
礼貌的吻别
礼貌的吻别 2020-11-22 08:04

I need 2 ways of showing vertical label in Android:

  1. Horizontal label turned 90 degrees counterclockwise (letters on the side)
  2. Horizontal label with l
10条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 08:30

    There are some minor things need to be pay attention on.

    It depends on the charset when choosing the rotate or the path ways. for example, if the target charset is English like, and the expected effect looks like,

    a
    b
    c
    d
    

    you can get this effect by drawing each character one by one, no rotate or path needed.

    enter image description here

    you may need rotate or path to get this effect.

    the tricky part is when you try to render charset such like Mongolian. the glyph in the Typeface need to be rotated 90 degree, so drawTextOnPath() will be a good candidate to use.

提交回复
热议问题