//获取文件资源 TypedArray mainNavIcon = context.getResources().obtainTypedArray(R.array.mainNavIcon); //获取普通资源 String[] mainNav = context.getResources().getStringArray(R.array.mainNav); //循环 if( null != mainNav ){ int titleLength = mainNav.length; for( int index = 0; index < titleLength; index++ ){ int feedResId = typedArray.getResourceId( index, 0 ); //... } }