how can I display multiple lines of text on a button

前端 未结 3 458
梦毁少年i
梦毁少年i 2020-12-14 00:18

My button\'s layout_width set to match_parent.

In order to display multi lines on the button, I tried:

  • insert \'\\n\' into the text on button

3条回答
  •  鱼传尺愫
    2020-12-14 00:45

    In case you want to do that programmaticaly you can use System.getProperty("line.separator") in the string to change lines. Like this:

    String mybuttontext=line1+System.getProperty("line.separator")+line2;
    

    and then set this String as buttons text.

提交回复
热议问题