How to pinch zoom an edittext in android?

后端 未结 3 1807
失恋的感觉
失恋的感觉 2021-01-15 11:31

Please suggest a way to zoom all the contents of the edittext when a pinch gesture is detected. Want to zoom like typical text editor apps like KingSoft and quickoffice.

3条回答
  •  天涯浪人
    2021-01-15 11:47

    To add tad's answer, you probably can use children of MetricAffectingSpan or CharacterStyle: http://developer.android.com/reference/android/text/style/MetricAffectingSpan.html

    You will have to handle copy/paste (with spans!), and it will be tedious.

    Note that you can derive your own spans from the existing classes, but I cannot say what will happen with them when you copy & paste the text into another application.

    OTOH, if you decide from the very beginning that your text is just plain text and there is only one span used for zooming, it may be not so tedious.

提交回复
热议问题