2011-08-16 44 views
3

如何连接两个字符串?android xml标签字符串结合

<TextView android:text="@string/[email protected]/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> 

机器人:文本= “@串/ APP_NAME @串/ APP_VERSION”

直接印刷的 “@串/ APP_NAME @串/ APP_VERSION。” 而不是字符串 模拟器它应该是像“APP 1.2”

回答

5

你不能做到这一点,如果你想在你的TextView使用两个字符串,你必须通过编程设置文本:

TextView tv = (TextView)findViewById(R.id.welcome); 
tv.setText(getString(R.string.app_name) + getString(R.string.app_version)); 
+0

所以,它不是possibl e通过xml,还是只是不支持这种用法的语法? – tom91136