I want to concat two strings for a TextView in android, Data Binding Api

前端 未结 10 816
太阳男子
太阳男子 2020-12-23 14:04

Im using DataBinding Api for setting the views in android layouts. Here is my layout.

layout.xml



        
10条回答
  •  独厮守ぢ
    2020-12-23 15:05

    In case of static string and other dynamic you can use this

    android:text="@{`Hello ` + user.firstName}"/>
    

    In case of dynamic data you can use this.

    android:text='@{user.firstName+" "+user.lastName}'
    

提交回复
热议问题