如何将字符串转换成变量? for循环得到i的值,然后把这个值赋值给strValue? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我的意思是当strValue=“"R.drawable.club_1”时,我怎么调用imageView1.setImageDrawable(getResources().getDrawable(R.drawable.card__club_1));不能 imageView1.setImageDrawable(getResources().getDrawable(strValue));这样写,应该怎么写呢? strValue是图片是名字,即club_1...R.drawable.card__club_1是个整型,是对应club_1的索引。所以,strValue直接用图片的名字就可以了,得到对应的图片id通过context.getResources().getIdentifier(“club_1”, "drawable", context.getPackageName())获取. 把R.drawable.club_1到R.drawable.club_7放在一个int类型的数组中,如:int[] club = {R.drawable.club_1,R.drawable.club_2,R.drawable.club_3,R.drawable.club_4,R.drawable.club_5,R.drawable.club_6,R.drawable.club_7};imageView1.setImageDrawable(getResources().getDrawable(R.drawable.card__club_1));就可以写成 imageView1.setImageDrawable(getResources().getDrawable(club[0])); 把R1-R7的int放到数组中,使用时用数组的索引号兑取 关于android中断 如何根据Android源代码编译出可以在模拟器上运行的img 如何设置MediaPlayer视频的控制次数循环播放 懂GUI的MY欢迎指教, DPI 问题 iscroll和phinegap结合制作下拉效果 ,不能拉到最底端 如何获取被设置为热点的android手机的本地ip地址 项目名称全是叉,怎么解决,求解 android sqlite关于数据表的问题 急求! webView长按的自由复制功能怎么手动调用和修改 如何获取同一WiFi下的所有连接终端的物理地址 openl 读取obj贴图出错 在创建AVD时如何设置--abi
R.drawable.card__club_1是个整型,是对应club_1的索引。所以,strValue直接用图片的名字就可以了,得到对应的图片id通过context.getResources().getIdentifier(“club_1”, "drawable", context.getPackageName())获取.
imageView1.setImageDrawable(getResources().getDrawable(R.drawable.card__club_1));就可以写成 imageView1.setImageDrawable(getResources().getDrawable(club[0]));