How do I use databinding to combine a string from resources with a dynamic variable in XML?

前端 未结 9 932
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 13:30

I have a TextView which has a hardcoded string and I have a dynamic variable that I want to put at the end of this string. This is my code:



        
9条回答
  •  死守一世寂寞
    2020-12-07 14:20

    Just using + operator works for me:

    android:text= "@{@string/Generic_Text +' '+ Profile.name)}"
    

    String.xml will be:

    Hello
    

提交回复
热议问题