R.string.Converasation包含會話 下面是代碼如何一次設置文本從string.xml和正常的字符串文本視圖
tv.setText(R.string.Converasation+"HELLo");
TextView的觀點正在R.的int值string.Converasation和HELLO的字符串值,最終顯示2131034187Hello,但我想ConverasationHello
如何解決這個..
R.string.Converasation包含會話 下面是代碼如何一次設置文本從string.xml和正常的字符串文本視圖
tv.setText(R.string.Converasation+"HELLo");
TextView的觀點正在R.的int值string.Converasation和HELLO的字符串值,最終顯示2131034187Hello,但我想ConverasationHello
如何解決這個..
應該是這樣:
tv.setText(getString(R.string.Converasation)+" Hello ");
僅供參考,您可以使用getString(int)或getText(int)來檢索字符串。
嘗試
tv.setText(getString(R.string.Converasation) + "HELLo");
馬克。
是我的答案不同於你的嗎? –
你可以做到這一點,如下所示:
tv.setText(getText(R.string.Conversation)+" Hello");
希望這會工作。
嘗試相同
tv.setText(getString(R.string.Converasation)+" Hello ");
@Mudassir一切都很正常。對我來說,它是:
display.setText(getText(R.string.counting_result) + " "+ counter);
非常感謝你 – Sando