我一直在尝试使用以下代码在按钮上设置图像,但它似乎不起作用...我认为我做错的是我正在使用的图像的路径,但我尝试了不同的路径,但它不会工作...我已将图像复制到 res 文件夹中的可绘制文件夹中...我在这里做错了什么?
final Button next = (Button) findViewById(R.id.Button02) ;
Drawable d = Drawable.createFromPath("@drawable/finalarrow1");
next.setBackgroundDrawable(d);
为什么不使用
final Button next = (Button) findViewById(R.id.Button02);
next.setBackgroundResource(R.drawable.finalarrow1);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)