Concatenate multiple strings in XML?

前端 未结 10 1027
执笔经年
执笔经年 2020-12-01 05:09

I go through this How to concatenate multiple strings in android XML? and in the end there are comments that

For clarity, Its works:

&

10条回答
  •  余生分开走
    2020-12-01 05:39

    Yes, you can do so without having to add any Java/Kotlin code, just XML, by using this library: https://github.com/LikeTheSalad/android-string-reference which does that at buildtime.

    For your case, you'd have to set up your strings like this:

    Some text
    bbb ${aaa}
    

    And then the library will create the following at buildtime:

    bbb Some text
    

    Disclaimer: I'm the author of this library.

提交回复
热议问题