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


Java ClipDrawable.VERTICAL属性代码示例

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


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

示例1: setShadow

private void setShadow(int drawableId) {
    Drawable original = ContextCompat.getDrawable(TranSappApplication.getAppContext(), drawableId) ;
    Drawable shadow = getClone(original).mutate();
    toGrayScale(shadow);

    Drawable background = getClone(original).mutate();
    background.setColorFilter(
            ContextCompat.getColor(getContext(), R.color.background_white), PorterDuff.Mode.SRC_ATOP);

    Drawable drawableArray[]= new Drawable[]{background, shadow};
    LayerDrawable layerDraw = new LayerDrawable(drawableArray);


    clipDrawable = new ClipDrawable(layerDraw, Gravity.BOTTOM, ClipDrawable.VERTICAL);
    this.shadow.setImageDrawable(clipDrawable);
}
 
开发者ID:InspectorIncognito,项目名称:androidApp,代码行数:16,代码来源:ReportView.java

示例2: refreshDrawable

protected void refreshDrawable(final Drawable drawable) {
	mDrawable = drawable;
	if (mDrawable == null) {
		mDrawable = new ColorDrawable(mColor);
	}
	int gravity = GRAVITY_FILL_VERTICAL | GRAVITY_LEFT;
	int orientation = ClipDrawable.HORIZONTAL;
	switch (mRotation) {
	case 90:
		gravity = GRAVITY_FILL_HORIZONTAL | GRAVITY_BOTTOM;
		orientation = ClipDrawable.VERTICAL;
		break;
	case 180:
		gravity = GRAVITY_FILL_VERTICAL | GRAVITY_RIGHT;
		orientation = ClipDrawable.HORIZONTAL;
		break;
	case 270:
		gravity = GRAVITY_FILL_HORIZONTAL | GRAVITY_TOP;
		orientation = ClipDrawable.VERTICAL;
		break;
	}
	mClipDrawable = new ClipDrawable(mDrawable, gravity, orientation);
	final Rect outRect = new Rect();
	getDrawingRect(outRect);
	mClipDrawable.setBounds(outRect);
	mClipDrawable.setLevel((int)(mProgress * mScale) + mMin);
	postInvalidate();
}
 
开发者ID:saki4510t,项目名称:libcommon,代码行数:28,代码来源:ProgressView.java

示例3: setMaskOrientation

/**
 * 设置方向
 * @param orientation {@link MaskOrientation}
 */
public void setMaskOrientation(int orientation){
    switch (orientation){
        case MaskOrientation.LeftToRight:
            gravity = Gravity.LEFT;
            orientaion = ClipDrawable.HORIZONTAL;
            break;
        case MaskOrientation.RightToLeft:
            gravity = Gravity.RIGHT;
            orientaion = ClipDrawable.HORIZONTAL;
            break;
        case MaskOrientation.TopToBottom:
            gravity = Gravity.TOP;
            orientaion = ClipDrawable.VERTICAL;
            break;
        case MaskOrientation.BottomToTop:
        default:
            gravity = Gravity.BOTTOM;
            orientaion = ClipDrawable.VERTICAL;
            break;
    }
    if(maskDrawable == null){
        return;
    }
    clipDrawable = new ClipDrawable(maskDrawable, gravity, orientaion);
    initAnim();
}
 
开发者ID:chiemy,项目名称:LoadingImageView,代码行数:30,代码来源:LoadingImageView.java

示例4: setupStickyHeader

void setupStickyHeader() {
    ClipDrawable d = new ClipDrawable(
            new ColorDrawable(ThemeUtils.getColorPrimary(getContext())),
            Gravity.BOTTOM, ClipDrawable.VERTICAL
    );
    d.setLevel(mIsStuck ? 10000 : 5000);
    mStickyHeader.setBackgroundDrawable(d);
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:8,代码来源:ProfilePortraitView.java

示例5: ColorDialog

public ColorDialog(Context context, boolean useAlpha, Object tag, int color, OnClickListener listener, int iconId) {
	super(context);
	mUseAlpha = useAlpha;
	mTag = tag;
	mListener = listener;

	Resources res = context.getResources();
	setTitle(res.getText(R.string.colorDialogTitle));
	setButton(BUTTON_POSITIVE, res.getText(android.R.string.ok), this);
	setButton(BUTTON_NEGATIVE, res.getText(android.R.string.cancel), this);
	View root = LayoutInflater.from(context).inflate(R.layout.color_picker, null);
	setView(root);
	
	View preview = root.findViewById(R.id.preview);
	mPreviewDrawable = new GradientDrawable();
	// 2 pix more than color_picker_frame's radius
	//mPreviewDrawable.setCornerRadius(7);
	Drawable[] layers;
	if (useAlpha) {
		mIcon = new IconPreviewDrawable(getContext().getResources(), iconId);
		ClipDrawable topClip = new ClipDrawable(mPreviewDrawable, Gravity.TOP, ClipDrawable.VERTICAL);
		topClip.setLevel(5000);
		layers = new Drawable[] {
				topClip,
				mIcon,
				res.getDrawable(R.drawable.color_picker_frame),
		};
	} else {
		layers = new Drawable[] {
				mPreviewDrawable,
				res.getDrawable(R.drawable.color_picker_frame),
		};
	}
	preview.setBackgroundDrawable(new LayerDrawable(layers));
	
	mHue = (SeekBar) root.findViewById(R.id.hue);
	mSaturation = (SeekBar) root.findViewById(R.id.saturation);
	mValue = (SeekBar) root.findViewById(R.id.value);
	mAlpha = (SeekBar) root.findViewById(R.id.alpha);
	
	mColor = color;
	float[] hsv = new float[3];
	Color.colorToHSV(color, hsv);
	int h = (int) (hsv[0] * mHue.getMax() / 360);
	int s = (int) (hsv[1] * mSaturation.getMax());
	int v = (int) (hsv[2] * mValue.getMax());
	setupSeekBar(mHue, R.string.colorHue, h, res);
	setupSeekBar(mSaturation, R.string.colorSaturation, s, res);
	setupSeekBar(mValue, R.string.colorValue, v, res);
	if (useAlpha) {
		int a = Color.alpha(color) * mAlpha.getMax() / 255;
		setupSeekBar(mAlpha, R.string.colorAlpha, a, res);
	} else {
		mAlpha.setVisibility(View.GONE);
	}
	
	updatePreview(color);
}
 
开发者ID:gskbyte,项目名称:kora,代码行数:58,代码来源:ColorDialog.java


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