Android 使用 array.xml

//获取文件资源
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 );

        //...

    }

}

 

posted @ 2015-01-19 15:15  TuWei  阅读(272)  评论(0编辑  收藏  举报