从自定义位置android以编程方式更改图标

时间:2016-01-27 08:03:23

标签: android imageview

如何在Android应用中更改图标。位于自定义位置。 例如:我在 drawable 中创建了新包,即 drawable / pre_paid_ico ,但是我无法以编程方式访问此位置的任何图标。这是我的代码

        iconView = (ImageView) findViewById(R.id.icon);
    int imageId = getResources().getIdentifier(array_ico[0], //icon name from array e.g[bg_icon]
            "drawable/pre_paid_ico",//location of icons
            "package.name.here");  //package Name
    iconView.setImageResource(imageId);

0 个答案:

没有答案
相关问题