當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewCompat.setLayerType方法代碼示例

本文整理匯總了Java中android.support.v4.view.ViewCompat.setLayerType方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewCompat.setLayerType方法的具體用法?Java ViewCompat.setLayerType怎麽用?Java ViewCompat.setLayerType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.view.ViewCompat的用法示例。


在下文中一共展示了ViewCompat.setLayerType方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dimChildView

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void dimChildView(View v, float mag, int fadeColor) {
    final LayoutParams lp = (LayoutParams) v.getLayoutParams();

    if (mag > 0 && fadeColor != 0) {
        final int baseAlpha = (fadeColor & 0xff000000) >>> 24;
        int imag = (int) (baseAlpha * mag);
        int color = imag << 24 | (fadeColor & 0xffffff);
        if (lp.dimPaint == null) {
            lp.dimPaint = new Paint();
        }
        lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_OVER));
        if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_HARDWARE) {
            ViewCompat.setLayerType(v, ViewCompat.LAYER_TYPE_HARDWARE, lp.dimPaint);
        }
        invalidateChildRegion(v);
    } else if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_NONE) {
        if (lp.dimPaint != null) {
            lp.dimPaint.setColorFilter(null);
        }
        final DisableLayerRunnable dlr = new DisableLayerRunnable(v);
        mPostedRunnables.add(dlr);
        ViewCompat.postOnAnimation(this, dlr);
    }
}
 
開發者ID:zhudongya123,項目名稱:WechatChatroomHelper,代碼行數:25,代碼來源:BGASwipeBackLayout.java

示例2: createShadowShapeDrawable

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
@Override
public Drawable createShadowShapeDrawable(Context context, CircleLoadingView circleLoadingView, int shadowColor) {
    final float density = context.getResources().getDisplayMetrics().density;
    mShadowRadius = (int) (density * SHADOW_RADIUS);
    final int diameter = (int) (RADIUS * density * 2);
    final int shadowYOffset = (int) (density * Y_OFFSET);
    final int shadowXOffset = (int) (density * X_OFFSET);
    OvalShape oval = new OvalShadow(mShadowRadius, diameter);
    ShapeDrawable circle = new ShapeDrawable(oval);
    ViewCompat.setLayerType(circleLoadingView, ViewCompat.LAYER_TYPE_SOFTWARE, circle.getPaint());
    circle.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset,
            KEY_SHADOW_COLOR);
    final int padding = mShadowRadius;
    // set padding so the inner image sits correctly within the shadow.
    circleLoadingView.setPadding(padding, padding, padding, padding);
    return circle;
}
 
開發者ID:lliuguangbo,項目名稱:circleloadingview,代碼行數:18,代碼來源:CircleLoadingView.java

示例3: dimChildView

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void dimChildView(View v, float mag, int fadeColor) {
    LayoutParams lp = (LayoutParams) v.getLayoutParams();
    if (mag > 0.0f && fadeColor != 0) {
        int color = (((int) (((float) ((-16777216 & fadeColor) >>> 24)) * mag)) << 24) | (ViewCompat.MEASURED_SIZE_MASK & fadeColor);
        if (lp.dimPaint == null) {
            lp.dimPaint = new Paint();
        }
        lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, Mode.SRC_OVER));
        if (ViewCompat.getLayerType(v) != 2) {
            ViewCompat.setLayerType(v, 2, lp.dimPaint);
        }
        invalidateChildRegion(v);
    } else if (ViewCompat.getLayerType(v) != 0) {
        if (lp.dimPaint != null) {
            lp.dimPaint.setColorFilter(null);
        }
        DisableLayerRunnable dlr = new DisableLayerRunnable(v);
        this.mPostedRunnables.add(dlr);
        ViewCompat.postOnAnimation(this, dlr);
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:22,代碼來源:SlidingPaneLayout.java

示例4: enableLayers

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:DirectionalViewpager.java

示例5: run

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
public void run() {
    if (this.mChildView.getParent() == SlidingPaneLayout.this) {
        ViewCompat.setLayerType(this.mChildView, 0, null);
        SlidingPaneLayout.this.invalidateChildRegion(this.mChildView);
    }
    SlidingPaneLayout.this.mPostedRunnables.remove(this);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:8,代碼來源:SlidingPaneLayout.java

示例6: run

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
@Override
public void run() {
    if (mChildView.getParent() == ResideLayout.this) {
        ViewCompat.setLayerType(mChildView, ViewCompat.LAYER_TYPE_NONE, null);
        invalidateChildRegion(mChildView);
    }
    mPostedRunnables.remove(this);
}
 
開發者ID:Jusenr,項目名稱:RX_Demo,代碼行數:9,代碼來源:ResideLayout.java

示例7: dimChildView

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void dimChildView(View v, float mag, int fadeColor) {
    final LayoutParams lp = (LayoutParams) v.getLayoutParams();

    if (mag > 0 && fadeColor != 0) {
        final int baseAlpha = (fadeColor & 0xff000000) >>> 24;
        int imag = (int) (baseAlpha * mag);
        int color = imag << 24 | (fadeColor & 0xffffff);
        if (lp.dimPaint == null) {
            lp.dimPaint = new Paint();
        }
        lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_OVER));
        if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_HARDWARE) {
            ViewCompat.setLayerType(v, ViewCompat.LAYER_TYPE_HARDWARE, lp.dimPaint);
        }


        invalidateChildRegion(v);
    } else if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_NONE) {
        if (lp.dimPaint != null) {
            lp.dimPaint.setColorFilter(null);
        }
        final DisableLayerRunnable dlr = new DisableLayerRunnable(v);
        mPostedRunnables.add(dlr);
        ViewCompat.postOnAnimation(this, dlr);
        childHeight = lp.height;
    }
}
 
開發者ID:chemickypes,項目名稱:Glitchy,代碼行數:28,代碼來源:SideMenu.java

示例8: enableLayers

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable
                ? ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
開發者ID:youngkaaa,項目名稱:YViewPagerDemo,代碼行數:9,代碼來源:YViewPager.java

示例9: enableLayers

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable
                ? mPageTransformerLayerType : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
開發者ID:SimonCherryGZ,項目名稱:JewelryUI,代碼行數:9,代碼來源:ViewPager.java

示例10: enableLayers

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void enableLayers(boolean enable) {
	final int childCount = getChildCount();
	for (int i = 0; i < childCount; i++) {
		final int layerType = enable ? ViewCompat.LAYER_TYPE_HARDWARE
			: ViewCompat.LAYER_TYPE_NONE;
		ViewCompat.setLayerType(getChildAt(i), layerType, null);
	}
}
 
開發者ID:fengshihao,項目名稱:WebPager,代碼行數:9,代碼來源:CustomViewPager.java

示例11: init

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void init(Context context, AttributeSet attrs, int defStyleAttr) {

        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DoubleSeekBar, defStyleAttr, R.style.DoubleSeekBar);
        mThumbRadius = a.getDimensionPixelSize(R.styleable.DoubleSeekBar_DB_ThumbRadius, 0);
        mThumbColor = a.getColor(R.styleable.DoubleSeekBar_DB_ThumbColor, 0);
        mTextColor = a.getColor(R.styleable.DoubleSeekBar_DB_TextColor, 0);
        mProgressColor = a.getColor(R.styleable.DoubleSeekBar_DB_ProgressColor, 0);
        mProgressBackgroundColor = a.getColor(R.styleable.DoubleSeekBar_DB_ProgressBackgroundColor, 0);
        mTextSize = a.getDimensionPixelSize(R.styleable.DoubleSeekBar_DB_TextSize, 0);
        mProgressWidth = a.getDimensionPixelOffset(R.styleable.DoubleSeekBar_DB_ProgressWidth, 0);
        a.recycle();
        //初始化畫筆
        mTextPaint.setTextSize(mTextSize);
        mTextPaint.setColor(mTextColor);
        paint_Point.setColor(Color.BLACK);//畫點顏色
        //paint_Line=a.getColor(R.styleable.DoubleSeekBar_DB_ProgressColor, 0);//畫線顏色

        mProgressPaint.setStrokeCap(Paint.Cap.ROUND);
        mProgressPaint.setStyle(Paint.Style.STROKE);
        mProgressPaint.setStrokeWidth(mProgressWidth);

        mThumbShadowRadius = (int) (getResources().getDisplayMetrics().density * THUMB_SHADOW);
        mYOffset = (int) (getResources().getDisplayMetrics().density * Y_OFFSET);
        if(!isInEditMode()) {
            ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, mThumbPaint);
            mThumbPaint.setShadowLayer(mThumbShadowRadius, 0, mYOffset, KEY_SHADOW_COLOR);
        }
        mThumbPaint.setColor(mThumbColor);
    }
 
開發者ID:qinhan0323,項目名稱:DoubleSeekBar,代碼行數:30,代碼來源:DoubleSeekBar.java

示例12: run

import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
@Override
public void run() {
    if (mChildView.getParent() == this) {
        ViewCompat.setLayerType(mChildView, ViewCompat.LAYER_TYPE_NONE, null);
        invalidateChildRegion(mChildView);
    }
    mPostedRunnables.remove(this);
}
 
開發者ID:zhudongya123,項目名稱:WechatChatroomHelper,代碼行數:9,代碼來源:BGASwipeBackLayout2.java


注:本文中的android.support.v4.view.ViewCompat.setLayerType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。