当前位置: 首页>>代码示例>>Java>>正文


Java View.setLayerType方法代码示例

本文整理汇总了Java中android.view.View.setLayerType方法的典型用法代码示例。如果您正苦于以下问题:Java View.setLayerType方法的具体用法?Java View.setLayerType怎么用?Java View.setLayerType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.setLayerType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addView

import android.view.View; //导入方法依赖的package包/类
void addView(final int position) {
	View root = createView(position, mParent);
	root.setOnTouchListener(this);
	root.setTag(R.id.cardstack_internal_position_tag, position);
	root.setLayerType(View.LAYER_TYPE_HARDWARE, null);

	mCardPaddingInternal = root.getPaddingTop();

	FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, fullCardHeight);
	root.setLayoutParams(lp);
	if (mShowInitAnimation) {
		root.setY(getCardFinalY(position));
		setScreenTouchable(false);
	} else {
		root.setY(getCardOriginalY(position) - mParentPaddingTop);
		setScreenTouchable(true);
	}

	mCardViews[position] = root;

	mParent.addView(root);
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:23,代码来源:CardStackAdapter.java

示例2: greyItem

import android.view.View; //导入方法依赖的package包/类
/**
     * 变化Item的灰度值
     * @param child 需要设置灰度值的Item
     * @param frame 位置信息
     */
    private void greyItem(View child, Rect frame) {
        float value = computeGreyScale(frame.left - mOffsetAll);
        ColorMatrix cm = new ColorMatrix(new float[]{
                value, 0, 0, 0, 120*(1-value),
                0, value, 0, 0, 120*(1-value),
                0, 0, value, 0, 120*(1-value),
                0, 0, 0, 1, 250*(1-value),
        });
//            cm.setSaturation(0.9f);

        // Create a paint object with color matrix
        Paint greyPaint = new Paint();
        greyPaint.setColorFilter(new ColorMatrixColorFilter(cm));

        // Create a hardware layer with the grey paint
        child.setLayerType(View.LAYER_TYPE_HARDWARE, greyPaint);
        if (value >= 1) {
            // Remove the hardware layer
            child.setLayerType(View.LAYER_TYPE_NONE, null);
        }

    }
 
开发者ID:ChenLittlePing,项目名称:RecyclerCoverFlow,代码行数:28,代码来源:CoverFlowLayoutManger.java

示例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);
	}
}
 
开发者ID:hishamMuneer,项目名称:JazzyViewPager,代码行数:11,代码来源:JazzyViewPager.java

示例4: setGreyscale

import android.view.View; //导入方法依赖的package包/类
/**
 * 设置View的灰度
 */
public static void setGreyscale(View v, boolean greyscale) {
    if (greyscale) {
        // Create a paint object with 0 saturation (black and white)
        ColorMatrix cm = new ColorMatrix();
        cm.setSaturation(0);
        Paint greyscalePaint = new Paint();
        greyscalePaint.setColorFilter(new ColorMatrixColorFilter(cm));
        // Create a hardware layer with the greyscale paint
        v.setLayerType(LAYER_TYPE_HARDWARE, greyscalePaint);
    } else {
        // Remove the hardware layer
        v.setLayerType(LAYER_TYPE_NONE, null);
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:18,代码来源:ResUtil.java

示例5: addNextView

import android.view.View; //导入方法依赖的package包/类
private void addNextView() {
    if (adapterIndex < mAdapter.getCount()) {
        View newBottomChild = mAdapter.getView(adapterIndex, null, this);
        newBottomChild.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        //todo: i'm setting the card to invisible initially and making it visible when i animate
        //later
        newBottomChild.setAlpha(0);
        newBottomChild.setY(getPaddingTop());
        final long viewId = mAdapter.getItemId(adapterIndex);

        CardContainer card = new CardContainer(newBottomChild, this, new CardContainerCallback(viewId));

        card.setPositionWithinAdapter(adapterIndex);

        if (leftImageResource != 0) {
            card.setLeftImageResource(leftImageResource);
        }
        if (rightImageResource != 0) {
            card.setRightImageResource(rightImageResource);
        }

        card.setId(viewId);

        deck.addBack(card);
        adapterIndex++;
    }
}
 
开发者ID:pao11,项目名称:SwipeDeckRelease,代码行数:28,代码来源:SwipeDeck.java

示例6: 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);
}
 
开发者ID:SimonCherryGZ,项目名称:JewelryUI,代码行数:8,代码来源:JazzyViewPager.java

示例7: 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);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:10,代码来源:JazzyViewPager.java

示例8: 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);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:12,代码来源:JazzyViewPager.java

示例9: setSepiaLayer

import android.view.View; //导入方法依赖的package包/类
private void setSepiaLayer (View view, boolean isSepiaLayerOn) {
    if (!IS_JBMR2) {
        if (isSepiaLayerOn) {
            view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            view.setLayerPaint(mSepiaPaint);
        } else {
            view.setLayerPaint(mDefaultPaint);
        }
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:11,代码来源:FoldingLayoutActivity.java

示例10: setLayerType

import android.view.View; //导入方法依赖的package包/类
@TargetApi(11)
public static void setLayerType(View view, int layerType, Paint paint) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        view.setLayerType(layerType, paint);
    }
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:7,代码来源:MethodsCompat.java

示例11: setLayerType

import android.view.View; //导入方法依赖的package包/类
public static void setLayerType(View view, int layerType) {
	view.setLayerType(layerType, null);
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:4,代码来源:ViewCompat.java

示例12: setLayerType

import android.view.View; //导入方法依赖的package包/类
public static void setLayerType(View view, int layerType, Paint paint) {
    view.setLayerType(layerType, paint);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:ViewCompatHC.java

示例13: setLayerType

import android.view.View; //导入方法依赖的package包/类
public static void setLayerType(View view, int layerType) {
    view.setLayerType(layerType, null);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:ViewCompat.java

示例14: bindPost

import android.view.View; //导入方法依赖的package包/类
private void bindPost(PostViewHolder viewHolder, Post post) {
    viewHolder.title.setText(post.getTitle());
    if (! TextUtils.isEmpty(post.getFeatureImage())) {
        String imageUrl = NetworkUtils.makeAbsoluteUrl(mBlogUrl, post.getFeatureImage());
        viewHolder.image.setVisibility(View.VISIBLE);
        mPicasso.load(imageUrl)
                .fit().centerCrop()
                .into(viewHolder.image);
    } else {
        viewHolder.image.setVisibility(View.GONE);
        viewHolder.image.setImageResource(android.R.color.transparent);
    }
    @ColorInt int postStatusColor = PostUtils.getStatusColor(post, mContext);
    viewHolder.statusIcon.setImageResource(PostUtils.getStatusIconResId(post));
    viewHolder.statusIcon.setColorFilter(postStatusColor, PorterDuff.Mode.SRC_IN);
    viewHolder.statusText.setText(PostUtils.getStatusString(post, mContext));
    viewHolder.statusText.setTextColor(postStatusColor);
    List<Tag> tags = post.getTags();
    if (tags.size() > 0) {
        String tagsStr = "#" + tags.get(0).getName();
        if (tags.size() > 1) {
            tagsStr += " +" + (tags.size()-1);
        }
        viewHolder.tags.setText(tagsStr);
        viewHolder.tags.setVisibility(View.VISIBLE);
    } else {
        viewHolder.tags.setVisibility(View.GONE);
    }

    // grey out to-be-deleted posts, by making all the child Views of the item translucent
    ViewGroup viewGroup = (ViewGroup) viewHolder.itemView;
    boolean isMarkedForDeletion = post.isMarkedForDeletion();
    for (int i = 0, len = viewGroup.getChildCount(); i < len; ++i) {
        View childView = viewGroup.getChildAt(i);
        if (isMarkedForDeletion) {
            childView.setLayerType(View.LAYER_TYPE_HARDWARE, mLowAlphaPaint);
        } else {
            childView.setLayerType(View.LAYER_TYPE_NONE, null);
        }
    }
}
 
开发者ID:TryGhost,项目名称:Ghost-Android,代码行数:42,代码来源:PostAdapter.java

示例15: setHoldView

import android.view.View; //导入方法依赖的package包/类
final public void setHoldView(View v) {
    mViewCache.setHoldView(v);
    if (softwareRender()) {
        v.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
}
 
开发者ID:alibaba,项目名称:Virtualview-Android,代码行数:7,代码来源:ViewBase.java


注:本文中的android.view.View.setLayerType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。