How to set drawableRIGHTon Android button?(IMAGE DINAMICALLY) -
drawable drawable = res.getdrawable(r.drawable.image); button.setcompounddrawableswithintrinsicbounds(null, null, drawable, null); this work dinamically.
drawable drawable = res.getdrawable(r.drawable.path); button.setcompounddrawableswithintrinsicbounds(null, null, drawable, null); where path string contains name of image.. all!
if got right, trying drawable image name. right? if so,
int imageresource = res.getidentifier(path, "drawable", getcontext().getpackagename()); drawable drawable = res.getdrawable(imageresource); then assign button drawable...
Comments
Post a Comment