Skip to content Skip to sidebar Skip to footer

Android Set Radius Programatically To Shapedrawable

Can I set a radius programmatically to a ShapeDrawable?

Solution 1:

try this:

        LayerDrawable bgDrawable = (LayerDrawable) btnCallnow.getBackground();
        final GradientDrawable shape = (GradientDrawable) bgDrawable.findDrawableByLayerId(R.id.shape_id);
        shape.setCornerRadius(5.0f);

Post a Comment for "Android Set Radius Programatically To Shapedrawable"