Example usage for android.view ViewOutlineProvider BOUNDS

List of usage examples for android.view ViewOutlineProvider BOUNDS

Introduction

In this page you can find the example usage for android.view ViewOutlineProvider BOUNDS.

Prototype

ViewOutlineProvider BOUNDS

To view the source code for android.view ViewOutlineProvider BOUNDS.

Click Source Link

Document

Maintains the outline of the View to match its rectangular bounds, at 1.0f alpha.

Usage

From source file:Main.java

static void setBoundsViewOutlineProvider(View view) {
    view.setOutlineProvider(ViewOutlineProvider.BOUNDS);
}

From source file:me.sweetll.tucao.widget.ForegroundRelativeLayout.java

public ForegroundRelativeLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ForegroundView);

    final Drawable d = a.getDrawable(R.styleable.ForegroundView_android_foreground);
    if (d != null) {
        setForeground(d);//from   w  ww.j  av a  2  s  . c om
    }
    a.recycle();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setOutlineProvider(ViewOutlineProvider.BOUNDS);
    }
}

From source file:com.roughike.bottombar.BottomBar.java

@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
private void init21(Context context) {
    if (showShadow) {
        shadowElevation = getElevation();
        shadowElevation = shadowElevation > 0 ? shadowElevation
                : getResources().getDimensionPixelSize(R.dimen.bb_default_elevation);
        setElevation(MiscUtils.dpToPixel(context, shadowElevation));
        setOutlineProvider(ViewOutlineProvider.BOUNDS);
    }/* w  w  w  .  j  a  v a  2 s .  co m*/
}

From source file:ticwear.design.widget.AppBarLayout.java

public AppBarLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    setOrientation(VERTICAL);//from w  w  w  .j ava2s  . co m

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AppBarLayout, 0,
            R.style.Widget_Ticwear_AppBarLayout);
    mTargetElevation = a.getDimensionPixelSize(R.styleable.AppBarLayout_android_elevation, 0);
    setBackgroundDrawable(a.getDrawable(R.styleable.AppBarLayout_android_background));
    if (a.hasValue(R.styleable.AppBarLayout_tic_expanded)) {
        setExpanded(a.getBoolean(R.styleable.AppBarLayout_tic_expanded, false));
    }
    a.recycle();

    // Use the bounds view outline provider so that we cast a shadow, even without a background
    setOutlineProvider(ViewOutlineProvider.BOUNDS);

    mListeners = new ArrayList<>();

    ViewCompat.setElevation(this, mTargetElevation);

    ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() {
        @Override
        public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) {
            if (isShown()) {
                setWindowInsets(insets);
                return insets.consumeSystemWindowInsets();
            } else {
                return insets;
            }
        }
    });
}