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


Java View.LAYER_TYPE_SOFTWARE屬性代碼示例

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


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

示例1: setCropShape

/**
 * The shape of the cropping area - rectangle/circular.
 */
public void setCropShape(CropImageView.CropShape cropShape) {
    if (mCropShape != cropShape) {
        mCropShape = cropShape;
        if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 17) {
            if (mCropShape == CropImageView.CropShape.OVAL) {
                mOriginalLayerType = getLayerType();
                if (mOriginalLayerType != View.LAYER_TYPE_SOFTWARE) {
                    // TURN off hardware acceleration
                    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
                } else {
                    mOriginalLayerType = null;
                }
            } else if (mOriginalLayerType != null) {
                // return hardware acceleration back
                setLayerType(mOriginalLayerType, null);
                mOriginalLayerType = null;
            }
        }
        invalidate();
    }
}
 
開發者ID:garretyoder,項目名稱:Cluttr,代碼行數:24,代碼來源:CropOverlayView.java

示例2: updateFromViewRotation

private void updateFromViewRotation() {
    if (Build.VERSION.SDK_INT == 19) {
        // KitKat seems to have an issue with views which are rotated with angles which are
        // not divisible by 90. Worked around by moving to software rendering in these cases.
        if ((mRotation % 90) != 0) {
            if (mView.getLayerType() != View.LAYER_TYPE_SOFTWARE) {
                mView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            }
        } else {
            if (mView.getLayerType() != View.LAYER_TYPE_NONE) {
                mView.setLayerType(View.LAYER_TYPE_NONE, null);
            }
        }
    }

    // Offset any View rotation
    if (mShadowDrawable != null) {
        mShadowDrawable.setRotation(-mRotation);
    }
    if (mBorderDrawable != null) {
        mBorderDrawable.setRotation(-mRotation);
    }
}
 
開發者ID:commonsguy,項目名稱:cwac-crossport,代碼行數:23,代碼來源:FloatingActionButtonImpl.java

示例3: setCropShape

/** The shape of the cropping area - rectangle/circular. */
public void setCropShape(CropImageView.CropShape cropShape) {
  if (mCropShape != cropShape) {
    mCropShape = cropShape;
    if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 17) {
      if (mCropShape == CropImageView.CropShape.OVAL) {
        mOriginalLayerType = getLayerType();
        if (mOriginalLayerType != View.LAYER_TYPE_SOFTWARE) {
          // TURN off hardware acceleration
          setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        } else {
          mOriginalLayerType = null;
        }
      } else if (mOriginalLayerType != null) {
        // return hardware acceleration back
        setLayerType(mOriginalLayerType, null);
        mOriginalLayerType = null;
      }
    }
    invalidate();
  }
}
 
開發者ID:prashantsaini1,項目名稱:android-titanium-imagecropper,代碼行數:22,代碼來源:CropOverlayView.java

示例4: fixCanvasScalingWhenHardwareAccelerated

private static void fixCanvasScalingWhenHardwareAccelerated(ProgressBar pb) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB &&
            Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
        // Canvas scaling when hardware accelerated results in artifacts on older API levels, so
        // we need to use software rendering
        if (pb.isHardwareAccelerated() && pb.getLayerType() != View.LAYER_TYPE_SOFTWARE) {
            pb.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:10,代碼來源:DialogInit.java

示例5: draw

public static void draw(Canvas canvas, View view, Config config) {
    Check.ifNull(canvas);
    Check.ifNull(view);
    Check.ifNull(config);

    View parent = (View) view.getParent();
    if (parent.getLayerType() != View.LAYER_TYPE_SOFTWARE) {
        parent.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        return;
    }

    int count = canvas.save();
    int viewHeight = view.getHeight();
    int viewWidth = view.getWidth();
    float padding = config.radius * RATIO;
    int xOffset = config.xOffset;
    int yOffset = config.yOffset;

    initPath(viewWidth, viewHeight, config);

    try {
        /*
            clipPath時部分4.0 手機會拋出如下異常, 比如
            OPPO X907 cpu高通驍龍Snapdragon MSM8260 內存1GB 係統版本4.0.3 分辨率800x480
            FATAL EXCEPTION:main
            java.lang.UnsupportedOperationException
            at android.view.GLES20Canvas.clipPath(GLES20Canvas.java:429)
        */
        canvas.clipPath(sPath, Region.Op.REPLACE);
    } catch (Exception e) {
        Log.e("shadow", "不支持clipPath");
        e.printStackTrace();
        canvas.restoreToCount(count);
        config.recycle();
        return;

    }

    sRectF.left = xOffset - padding;
    sRectF.top = yOffset - padding;
    sRectF.right = viewWidth + xOffset + padding;
    sRectF.bottom = viewHeight + yOffset + padding;

    canvas.clipRect(sRectF, Region.Op.REVERSE_DIFFERENCE);

    canvas.translate(xOffset, yOffset);

    sPaint.setColor(config.color);
    sPaint.setMaskFilter(new BlurMaskFilter(config.radius, BlurMaskFilter.Blur.NORMAL));

    canvas.drawPath(sPath, sPaint);

    canvas.restoreToCount(count);
    config.recycle();
}
 
開發者ID:android-notes,項目名稱:shadow,代碼行數:55,代碼來源:ShadowHelper.java

示例6: RevealFinishedIceCreamSandwich

RevealFinishedIceCreamSandwich(RevealAnimator target) {
    super(target);

    mLayerType = ((View) target).getLayerType();
    mFeaturedLayerType = View.LAYER_TYPE_SOFTWARE;
}
 
開發者ID:SimonCherryGZ,項目名稱:JewelryUI,代碼行數:6,代碼來源:RevealAnimator.java


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