我想打一个观点有两种不同的颜色,所以我想在我的fragment
安卓:根据需要
TextView welcome = (TextView) view.findViewById(R.id.welcome_text_ID);
View sample = getActivity().findViewById(R.string.sample);
welcome.setText("Welcome to " + sample);
这个代码文本字符串资源不工作,它说“欢迎来到空”
然后我尝试这个
TextView welcome = (TextView) view.findViewById(R.id.welcome_text_ID);
welcome.setText("Welcome to " + (R.string.sample));
,我也得到 “欢迎x1029203”
这是在实际的R.java
文件中找到的string
值的int
的参考。任何帮助表示感谢。
再次感谢您!答案接受...在9分钟=) – IrishWhiskey 2013-05-11 23:57:02