本文整理汇总了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);
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}