Vertical (rotated) label in Android

后端 未结 10 1102
礼貌的吻别
礼貌的吻别 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:34

    Tried both of the VerticalTextView classes in the approved answer, and they worked reasonably well.

    But no matter what I tried, I was unable to position those VerticalTextViews in the center of the containing layout (a RelativeLayout which is part of an item inflated for a RecyclerView).

    FWIW, after looking around, I found yoog568's VerticalTextView class on GitHub:

    https://github.com/yoog568/VerticalTextView/blob/master/src/com/yoog/widget/VerticalTextView.java

    which I was able to position as desired. You also need to include the following attributes definition in your project:

    https://github.com/yoog568/VerticalTextView/blob/master/res/values/attr.xml

提交回复
热议问题