private void setupStandardButtonOutline() { Outline roundRectOutline = new Outline(); roundRectOutline.setRoundRect( 0, 0, standardButton.getLayoutParams().width, standardButton.getLayoutParams().height, 20); standardButton.setOutline(roundRectOutline); standardButton.setClipToOutline(true); }
@Override public void getOutline(View view, Outline outline) { int outlineLeft = view.getPaddingLeft(); int outlineTop = view.getPaddingTop(); // Apply padding to shadow. outline.setRoundRect( outlineLeft, outlineTop, view.getWidth() - outlineLeft - view.getPaddingRight(), view.getHeight() - outlineTop - view.getPaddingBottom(), sRoundedRectCornerRadius); }
@Override public void getOutline(@NonNull Outline outline) { final Rect bounds = getBounds(); if (bounds.isEmpty()) return; if (mNinePatchState != null) { NinePatch.InsetStruct insets = mNinePatchState.getBitmap().getNinePatchInsets(); if (insets != null) { final Rect outlineInsets = insets.outlineRect; outline.setRoundRect( bounds.left + outlineInsets.left, bounds.top + outlineInsets.top, bounds.right - outlineInsets.right, bounds.bottom - outlineInsets.bottom, insets.outlineRadius); outline.setAlpha(insets.outlineAlpha * (getAlpha() / 255.0f)); return; } } super.getOutline(outline); }
@Override public void getOutline(Outline outline) { outline.setRoundRect(mBoundsI, mRadius); }
@Override public void getOutline(@NonNull Outline outline) { outline.setRoundRect(getBounds(), cornerRadius); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void getOutline(@NonNull Outline outline) { outline.setRoundRect(getBounds(), cornerRadius); }
@Override public void setRoundRect(Rect rect, float radius) { outline.setRoundRect(rect, radius); }
@Override public void setRoundRect(int left, int top, int right, int bottom, float radius) { outline.setRoundRect(left, top, right, bottom, radius); }