Skip to content

Commit

Permalink
set shadow programmatically
Browse files Browse the repository at this point in the history
  • Loading branch information
jjobes committed Dec 12, 2014
1 parent 424c97c commit 397c27e
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -7,6 +7,7 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
Expand Down Expand Up @@ -103,6 +104,11 @@ public void setDrawable(Drawable drawable) {
invalidate();
}

public void setShadow(float radius, float dx, float dy, int color) {
mButtonPaint.setShadowLayer(radius, dx, dy, color);
invalidate();
}

@Override
protected void onDraw(Canvas canvas) {
canvas.drawCircle(getWidth() / 2, getHeight() / 2, (float) (getWidth() / 2.6), mButtonPaint);
Expand Down

0 comments on commit 397c27e

Please sign in to comment.