How to have a circular TextView

前端 未结 1 679
名媛妹妹
名媛妹妹 2021-02-02 14:33

I have been trying to make a circular TextView. Its a circle in which I want to accomodate whole space above a circular bubble as shown in image below.

Kind

相关标签:
1条回答
  • 2021-02-02 15:22

    You need to create a custom view, extending from TextView probably, setting the circle as background image, and calculate the text width / break the lines manually according to the width of the text.

    To calculate the width of a string, see How to calculate string font width in pixels?

    Some math and calculations is required of course to measure the available space per line; but I think that's the only way, as there's no standard component out there to do it.

    To place the text onto the view, use drawText of the Canvas class.

    0 讨论(0)
提交回复
热议问题