Home » Android » android – Two line text for MenuItem

android – Two line text for MenuItem

Posted by: admin June 15, 2020 Leave a comment

Questions:

Do you know how to have a two lines menu item title? I’ve tried using \n in the string or Html.fromHtml with
tag but it doesn’t work. Thanks

How to&Answers:

This is the recommended answer from Google:
“If text in a simple menu wraps to a second line, use a simple dialog instead. Simple dialogs can have rows with varying heights.”

https://material.io/guidelines/components/menus.html#menus-simple-menus

Answer:

You can use String line=System.getProperty("line.separator")


this will give you newline effect in string.