當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。