【发布时间】:2015-09-11 01:40:15
【问题描述】:
我正在尝试更改 ImageButton 的来源,但由于某种原因,我不断收到此错误消息:无法解析方法 'setImageResource' (android.graphics.drawable.Drawable)。
这是我尝试使用的代码:
<ImageButton
android:layout_width="32dp"
android:layout_height="32dp"
android:id="@+id/cuenta_1"
android:text="cuenta1"
android:background="@mipmap/ic_fondo"
android:layout_toLeftOf="@id/agregarCuenta"/>
在mainActivity中:
Drawable logo = new BitmapDrawable(bitmap);
findViewById(R.id.cuenta_2).setImageResource(logo);
知道如何解决这个问题吗?
【问题讨论】:
标签: java android html image imagebutton