android 取名字类似的图片id

来源:互联网 发布:淘宝怎么安装数字证书 编辑:程序博客网 时间:2024/04/27 19:11

如有图片kung_fu0_normal.png,kung_fu1_normal.png,kung_fu2_normal.png...

遍历的时候取出每个id:

int resid = getResources().getIdentifier("kung_fu" + position % 10+"_normal", "drawable",                    parent.getContext().getPackageName());