Reputation: 15738
How can I use newline \n
in data binding?
I tried below but it is not working as intended. Any help thanks in advance.
android:text="@{data.firstName + `\n` + data.lastName}"
Upvotes: 1
Views: 1279
Reputation: 35569
\n will work perfectly, but there are some cases where it will not work, just make sure you have not used that.
singleLine
If you have used android:singleLine="true"
then it will not work, it won't show text in next line.
maxLines
If you have used android:maxLines="1"
, then it will not work, it won't show text in next line.
Upvotes: 2