Write Multiline Text on Button in Android

后端 未结 8 1787
没有蜡笔的小新
没有蜡笔的小新 2021-01-11 15:59

I want to know, How to write Multiline Text on Button

 
相关标签:
8条回答
  • 2021-01-11 16:28

    For Android layout, multiple lines of text could be added to the elements.

    Create a new variable with the character endOfLine "\n" in the res/values/strings.xml.

    For example:

    <string name="multiplelines">Line1 \n Line2</string>
    

    Refer it in the layout file. For example,

    <Button
        android:id="@+id/start"
        android:text="@string/multiplelines"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent">
    </Button>
    
    0 讨论(0)
  • 2021-01-11 16:28

    The solution that can be used in strings.xml, the separator is \n within CDATA

    <string name="switch_on_bluetooth"><![CDATA[Allumer\nBluetooth]]></string>
    
    0 讨论(0)
提交回复
热议问题