为什么80%的码农都做不了架构师?>>>
使用情景:
实现帧动画步骤的控制,这样动态的获取Drawable资源对应的R id,播放到那一步就加载到哪一步
private void freshBall(int edu){ if(edu>10){edu=10; }AnimationDrawable animation=new AnimationDrawable(); Resources resources=getResources(); String package_name=getPackageName(); for(int i=1;i<=edu;i++){int id=resources.getIdentifier("jf"+i+"_2x","mipmap",package_name); Drawable drawable=resources.getDrawable(id); animation.addFrame(drawable,100); }imv_jf.setBackgroundDrawable(animation); animation.setOneShot(true); animation.start(); }