Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android xml tag strings combine

how to connect two strings?

<TextView android:text="@string/app_name.@string/app_version" android:layout_height="wrap_content" android:layout_width="fill_parent" android:gravity="center" android:layout_alignParentLeft="true" android:id="@+id/Welcome" android:textSize="34px"></TextView>

android:text="@string/app_name.@string/app_version"

the emulator directly printed "@string/app_name.@string/app_version" instead of the string it supposed to be something like "APP 1.2"

like image 895
tom91136 Avatar asked Apr 01 '26 23:04

tom91136


1 Answers

you can't do that, if you want to use two strings in your TextView, you'd have to set the text programmatically:

TextView tv = (TextView)findViewById(R.id.welcome);
tv.setText(getString(R.string.app_name) + getString(R.string.app_version));
like image 97
Smugrik Avatar answered Apr 08 '26 19:04

Smugrik