Android开发笔记-加载xml资源

1.Activity获取strings.xml中键的值 需要通过 getResources().getString(R.string.*)方法获得 以“state”为例

String value= getResources().getString(R.string.state);

2.Activity关联XML界面:onCreate方法中使用setContentView方法加载

setContentView(R.layout.xml页面名称);// 设置要显示的界面 res/layout

3.获取xml界面中的控件 :以ListView 和 TextView 为例

(ListView) findViewById(R.id.listView_list);
        
(TextView) findViewById(R.id.txtcurr_housename);
原文地址:https://www.cnblogs.com/merray/p/3171287.html