Android and   in TextView

前端 未结 7 1964
一向
一向 2020-12-12 18:52

is it possible to add   in TextView? Has anyone achieved similar functionality?

I want to have non-breakable space in TextView.

7条回答
  •  有刺的猬
    2020-12-12 19:20

    One unique situation I ran into was adding a non-breaking space to a string resource that took String.format parameters.

    
        Answered %d of %d
    
    

    I tried to simply copy and past the non-breaking space character into the string and it was replaced with a regular old space after compiling.

    Removing the formatted="false", numbering the format args and using the backslash notation worked for me:

    
        Answered %1$d\u00A0of\u00A0%2$d
    
    

提交回复
热议问题