android - What is the difference between setBackgroundResource and setBackgroundDrawable -
could tell me difference between setbackgroundresource(resourceid)
, setbackgrounddrawable(getresource().getdrawable(drawableid))
in android?
you can have @ android source code view class , find out there little difference!
public void setbackgroundresource(int resid) { if (resid != 0 && resid == mbackgroundresource) { return; } drawable d= null; if (resid != 0) { d = mresources.getdrawable(resid); } setbackground(d); mbackgroundresource = resid; }
and setbackground()
calls through setbackgrounddrawable()
...
public void setbackground(drawable background) { //noinspection deprecation setbackgrounddrawable(background); }
Comments
Post a Comment