Example usage for android.view View setLayerPaint

List of usage examples for android.view View setLayerPaint

Introduction

In this page you can find the example usage for android.view View setLayerPaint.

Prototype

public void setLayerPaint(@Nullable Paint paint) 

Source Link

Document

Updates the Paint object used with the current layer (used only if the current layer type is not set to #LAYER_TYPE_NONE ).

Usage

From source file:com.bar.foldinglayout.sample.FoldingLayoutActivity.java

@SuppressLint("NewApi")
private void setSepiaLayer(View view, boolean isSepiaLayerOn) {
    if (!IS_JBMR2) {
        if (isSepiaLayerOn) {
            if (Build.VERSION.SDK_INT >= 17) {
                view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
                view.setLayerPaint(mSepiaPaint);
            }// w  w  w  .  jav  a 2s. c  o  m

        } else {
            if (Build.VERSION.SDK_INT >= 17) {
                view.setLayerPaint(mDefaultPaint);
            }

        }
    }
}

From source file:com.example.android.foldinglayout.FoldingLayoutActivity.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void setSepiaLayer(View view, boolean isSepiaLayerOn) {
    if (hasApiLevel(Build.VERSION_CODES.JELLY_BEAN_MR1)) {
        if (isSepiaLayerOn) {
            view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            view.setLayerPaint(mSepiaPaint);
        } else {/*from  ww  w.j ava 2  s  . c o m*/
            view.setLayerPaint(mDefaultPaint);
        }
    }
}