本文整理汇总了Java中android.view.View.getLayerType方法的典型用法代码示例。如果您正苦于以下问题:Java View.getLayerType方法的具体用法?Java View.getLayerType怎么用?Java View.getLayerType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.getLayerType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: disableHardwareLayers
import android.view.View; //导入方法依赖的package包/类
private void disableHardwareLayers() {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) return;
for (int i = 0; i < mViewPageable.getChildCount(); i++) {
final View child = mViewPageable.getChildAt(i);
if (child.getLayerType() != View.LAYER_TYPE_NONE)
child.setLayerType(View.LAYER_TYPE_NONE, null);
}
}
示例2: manageLayer
import android.view.View; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void manageLayer(View v, boolean enableHardware) {
if (!API_11) return;
int layerType = enableHardware ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE;
if (layerType != v.getLayerType())
v.setLayerType(layerType, null);
}
示例3: disableHardwareLayer
import android.view.View; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void disableHardwareLayer() {
if (!API_11) return;
View v;
for (int i = 0; i < getChildCount(); i++) {
v = getChildAt(i);
if (v.getLayerType() != View.LAYER_TYPE_NONE)
v.setLayerType(View.LAYER_TYPE_NONE, null);
}
}
示例4: manageLayer
import android.view.View; //导入方法依赖的package包/类
@TargetApi(11)
private void manageLayer(View v, boolean enableHardware) {
if (API_11) {
int layerType = enableHardware ? 2 : 0;
if (layerType != v.getLayerType()) {
v.setLayerType(layerType, null);
}
}
}
示例5: disableHardwareLayer
import android.view.View; //导入方法依赖的package包/类
@TargetApi(11)
private void disableHardwareLayer() {
if (API_11) {
for (int i = 0; i < getChildCount(); i++) {
View v = getChildAt(i);
if (v.getLayerType() != 0) {
v.setLayerType(0, null);
}
}
}
}
示例6: createCircularReveal
import android.view.View; //导入方法依赖的package包/类
public static Animator createCircularReveal(View revealView, int centerX, int centerY,
float startRadius, float endRadius, int layerType) {
Animator animator = CircularRevealAnimator.ofRevealCircle(revealView, centerX, centerY,
startRadius, endRadius);
if (layerType != revealView.getLayerType()) {
animator.addListener(new CircularRevealAnimator.ChangeViewLayerTypeListener(revealView, layerType));
}
return animator;
}
示例7: enableHardwareLayer
import android.view.View; //导入方法依赖的package包/类
private void enableHardwareLayer(final View v) {
final int layerType = Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT ?
View.LAYER_TYPE_NONE : View.LAYER_TYPE_HARDWARE;
if (v.getLayerType() != layerType) v.setLayerType(layerType, null);
}
示例8: getLayerType
import android.view.View; //导入方法依赖的package包/类
public static int getLayerType(View view) {
return view.getLayerType();
}
示例9: draw
import android.view.View; //导入方法依赖的package包/类
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();
}
示例10: ChangeViewLayerTypeListener
import android.view.View; //导入方法依赖的package包/类
ChangeViewLayerTypeListener(View clipView, int layerType) {
this.clipView = clipView;
this.newLayerType = layerType;
this.originalLayerType = clipView.getLayerType();
}