Skip to content

Commit

Permalink
Fix set colorDrawable Invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
tangxiaolv committed Jun 13, 2016
1 parent 1584fd4 commit c41cbbd
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.StateListDrawable;
import android.net.Uri;
import android.support.annotation.DrawableRes;
import android.util.AttributeSet;
import android.widget.ImageView;

Expand Down Expand Up @@ -299,7 +298,7 @@ public void setImageDrawable(Drawable drawable) {
}

@Override
public void setImageResource(@DrawableRes int resId) {
public void setImageResource(int resId) {
if (mResource != resId) {
mResource = resId;
setImageDrawable(resolveResource());
Expand Down Expand Up @@ -372,6 +371,7 @@ private Bitmap drawableToBitmap(Drawable drawable) {
bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
}
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
} catch (Exception e) {
e.printStackTrace();
Expand Down

0 comments on commit c41cbbd

Please sign in to comment.