可能重复:
Android 动态字符串资源
我有以下内容:
TextView text = (TextView)vi.findViewById(R.id.text);
TextView txtSub = (TextView)vi.findViewById(R.id.txtSub);
TextView txtA = (TextView)vi.findViewById(R.id.txtA);
TextView txtB = (TextView)vi.findViewById(R.id.txtB);
是否可以使用字符串来访问这些(这只是伪代码)?
String resourceName = "text";
TextView text = (TextView)vi.findViewById(R.id. + resourceName);