开发者

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"开发者_C百科 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"


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));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜