android.view.View#setLayerType ( )源码实例Demo

下面列出了android.view.View#setLayerType ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: memory-game   文件: PopupWonView.java
private void animateStar(final View view, int delay) {
	ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 0, 1f);
	alpha.setDuration(100);
	ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0, 1f);
	ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0, 1f);
	AnimatorSet animatorSet = new AnimatorSet();
	animatorSet.playTogether(alpha, scaleX, scaleY);
	animatorSet.setInterpolator(new BounceInterpolator());
	animatorSet.setStartDelay(delay);
	animatorSet.setDuration(600);
	view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
	animatorSet.start();
	
	mHandler.postDelayed(new Runnable() {
		
		@Override
		public void run() {
			Music.showStar();
		}
	}, delay);
}
 
源代码2 项目: DynamicGrid   文件: DynamicGridView.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private ObjectAnimator createBaseWobble(final View v) {

    if (!isPreLollipop())
        v.setLayerType(LAYER_TYPE_SOFTWARE, null);

    ObjectAnimator animator = new ObjectAnimator();
    animator.setDuration(180);
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setPropertyName("rotation");
    animator.setTarget(v);
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            v.setLayerType(LAYER_TYPE_NONE, null);
        }
    });
    return animator;
}
 
源代码3 项目: UltimateAndroid   文件: 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);
            }

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

        }
    }
}
 
源代码4 项目: ClockView   文件: JazzyViewPager.java
@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);
}
 
public ShadowCircleTransformation(Context context, View view, float strokeSize) {
  super();
  view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  this.strokeSize = strokeSize;
  shadowColor = Color.WHITE;
  spaceBetween = .95f;
}
 
public void onAnimationStart(Animator animation) {
    getViews(mViews);
    for (View view : mViews) {
        mLayerType.add(view.getLayerType());
        view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    }
}
 
源代码7 项目: android-FlipView   文件: FlipView.java
/**
 * Enable a hardware layer for the view.
 * 
 * @param v
 * @param drawWithLayer
 */
private void setDrawWithLayer(View v, boolean drawWithLayer) {
	if (isHardwareAccelerated()) {
		if (v.getLayerType() != LAYER_TYPE_HARDWARE && drawWithLayer) {
			v.setLayerType(LAYER_TYPE_HARDWARE, null);
		} else if (v.getLayerType() != LAYER_TYPE_NONE && !drawWithLayer) {
			v.setLayerType(LAYER_TYPE_NONE, null);
		}
	}
}
 
源代码8 项目: ClockView   文件: JazzyViewPager.java
@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);
	}
}
 
源代码9 项目: ShadowDrawable   文件: ShadowDrawable.java
/**
 * 为指定View设置带阴影的背景
 * @param view 目标View
 * @param bgColor View背景色
 * @param shapeRadius View的圆角
 * @param shadowColor 阴影的颜色
 * @param shadowRadius 阴影的宽度
 * @param offsetX 阴影水平方向的偏移量
 * @param offsetY 阴影垂直方向的偏移量
 */
public static void setShadowDrawable(View view, int bgColor, int shapeRadius, int shadowColor, int shadowRadius, int offsetX, int offsetY) {
	ShadowDrawable drawable = new ShadowDrawable.Builder()
			.setBgColor(bgColor)
			.setShapeRadius(shapeRadius)
			.setShadowColor(shadowColor)
			.setShadowRadius(shadowRadius)
			.setOffsetX(offsetX)
			.setOffsetY(offsetY)
			.builder();
	view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
	ViewCompat.setBackground(view, drawable);
}
 
源代码10 项目: ShadowDrawable   文件: ShadowDrawable.java
/**
 * 为指定View设置指定形状并带阴影的背景
 * @param view 目标View
 * @param shape View的形状 取值可为:GradientDrawable.RECTANGLE, GradientDrawable.OVAL, GradientDrawable.RING
 * @param bgColor View背景色
 * @param shapeRadius View的圆角
 * @param shadowColor 阴影的颜色
 * @param shadowRadius 阴影的宽度
 * @param offsetX 阴影水平方向的偏移量
 * @param offsetY 阴影垂直方向的偏移量
 */
public static void setShadowDrawable(View view, int shape, int bgColor, int shapeRadius, int shadowColor, int shadowRadius, int offsetX, int offsetY) {
	ShadowDrawable drawable = new ShadowDrawable.Builder()
			.setShape(shape)
			.setBgColor(bgColor)
			.setShapeRadius(shapeRadius)
			.setShadowColor(shadowColor)
			.setShadowRadius(shadowRadius)
			.setOffsetX(offsetX)
			.setOffsetY(offsetY)
			.builder();
	view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
	ViewCompat.setBackground(view, drawable);
}
 
源代码11 项目: LB-Launcher   文件: SearchDropTargetBar.java
private void prepareStartAnimation(View v) {
    // Enable the hw layers before the animation starts (will be disabled in the onAnimationEnd
    // callback below)
    if (v != null) {
        v.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    }
}
 
源代码12 项目: Gazetti_Newspaper_Reader   文件: JazzyViewPager.java
@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);
	}
}
 
源代码13 项目: MiBandDecompiled   文件: d.java
public static void a(View view, int i)
{
    view.setLayerType(i, null);
}
 
源代码14 项目: effective_android_sample   文件: ViewCompat.java
public static void setLayerType(View view, int layerType) {
	view.setLayerType(layerType, null);
}
 
源代码15 项目: ONE-Unofficial   文件: ViewCompat.java
public static void setLayerType(View view, int layerType) {
	view.setLayerType(layerType, null);
}
 
源代码16 项目: IntroActivity   文件: BaseIntroFragment.java
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    // Set the View layer to a hardware rendering layer
    view.setLayerType(View.LAYER_TYPE_HARDWARE, null);

    // Set a tag on the View so we can use it for custom animations
    view.setTag(this);

    // Title
    TextView title = (TextView) view.findViewById(R.id.title);
    title.setText(getTitle());
    title.setTextColor(getTitleColor());

    // Description
    TextView description = (TextView) view.findViewById(R.id.description);
    description.setText(getDescription());
    description.setTextColor(getDescriptionColor());

    // ViewStub
    ViewStub viewStub = (ViewStub) view.findViewById(R.id.viewstub);
    switch (getResourceType()) {
        // If the resource ID represents a layout ID,
        // inflate the layout based on the ID
        case RESOURCE_TYPE_LAYOUT:
            if (getLayoutId() != 0) {
                viewStub.setLayoutResource(getLayoutId());
                viewStub.inflate();
            }
            break;

        // If the resource ID represents a drawable ID,
        // inflate the drawable layout and set the image resource
        case RESOURCE_TYPE_DRAWABLE:
            viewStub.setLayoutResource(R.layout.drawable_layout);
            viewStub.inflate();

            ImageView imageView = (ImageView) view.findViewById(R.id.imageview);
            imageView.setImageResource(getDrawableId());
            break;
    }
}
 
public static void setLayerType(View view, int layerType) {
	view.setLayerType(layerType, null);
}
 
源代码18 项目: bmob-android-demo-paging   文件: ViewCompat.java
public static void setLayerType(View view, int layerType) {
	view.setLayerType(layerType, null);
}
 
源代码19 项目: SwipeMenuAndRefresh   文件: ViewCompat.java
public static void setLayerType(View view, int layerType) {
	view.setLayerType(layerType, null);
}
 
源代码20 项目: TigerVideo   文件: DisplayManager.java
public static void setLayerType(View view, int layerType, Paint paint) {
    view.setLayerType(layerType, paint);
}
 
 方法所在类
 同类方法