How to wrap text in textview in Android

前端 未结 18 1140
旧巷少年郎
旧巷少年郎 2020-12-08 18:03

Does any one know how to wrap text in TextView in Android platform. i.e if the text in textview exceed the screen length it should be displayed in the second line.

I

18条回答
  •  不知归路
    2020-12-08 18:34

    Use app:breakStrategy="simple" in AppCompatTextView, it will control over paragraph layout.

    It has three constant values

    • balanced
    • high_quality
    • simple

    Designing in your TextView xml

    
    

    If your current minimum api level is 23 or more then in Coding

    yourtextview.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE);
    

    For more refrence refer this BreakStrategy

提交回复
热议问题