本文整理汇总了Java中android.graphics.Color.WHITE属性的典型用法代码示例。如果您正苦于以下问题:Java Color.WHITE属性的具体用法?Java Color.WHITE怎么用?Java Color.WHITE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.graphics.Color
的用法示例。
在下文中一共展示了Color.WHITE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
private void initView(Context context, AttributeSet attrs) {
color = Color.WHITE;
width = dpToPx(context, DEFAULT_WIDTH);
shadowPosition = dpToPx(getContext(), DEFAULT_SHADOW_POSITION);
speedOfDegree = DEFAULT_SPEED_OF_DEGREE;
if (null != attrs) {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RotateLoading);
color = typedArray.getColor(R.styleable.RotateLoading_loading_color, Color.WHITE);
width = typedArray.getDimensionPixelSize(R.styleable.RotateLoading_loading_width, dpToPx(context, DEFAULT_WIDTH));
shadowPosition = typedArray.getInt(R.styleable.RotateLoading_shadow_position, DEFAULT_SHADOW_POSITION);
speedOfDegree = typedArray.getInt(R.styleable.RotateLoading_loading_speed, DEFAULT_SPEED_OF_DEGREE);
typedArray.recycle();
}
speedOfArc = speedOfDegree / 4;
mPaint = new Paint();
mPaint.setColor(color);
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(width);
mPaint.setStrokeCap(Paint.Cap.ROUND);
}
示例2: setColor
/**
* Set the bar color. <br>
* <br>
* Its discouraged to use this method.
*
* @param color
*/
public void setColor(int color) {
int x1, y1;
if (mOrientation) {
x1 = (mBarLength + mBarPointerHaloRadius);
y1 = mBarThickness;
} else {
x1 = mBarThickness;
y1 = (mBarLength + mBarPointerHaloRadius);
}
Color.colorToHSV(color, mHSVColor);
shader = new LinearGradient(mBarPointerHaloRadius, 0, x1, y1,
new int[] { Color.WHITE, color, Color.BLACK }, null,
Shader.TileMode.CLAMP);
mBarPaint.setShader(shader);
calculateColor(mBarPointerPosition);
mBarPointerPaint.setColor(mColor);
if (mPicker != null) {
mPicker.setNewCenterColor(mColor);
if (mPicker.hasOpacityBar())
mPicker.changeOpacityBarColor(mColor);
}
invalidate();
}
示例3: setStatusBarColor
public static void setStatusBarColor(Activity activity, int statusColor, boolean isLight) {
if (Color.WHITE == statusColor && Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
statusColor = calculateStatusBarColor(statusColor, 30);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
StatusBarCompatLollipop.setStatusBarColor(activity, statusColor, isLight);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
StatusBarCompatKitKat.setStatusBarColor(activity, statusColor);
}
}
示例4: getPressedStyleColor
@ColorInt
private int getPressedStyleColor(int style) {
switch (style) {
case DARK: {
return Color.BLACK;
}
case LIGHT: {
return Color.WHITE;
}
case NONE:
default: {
return -1;
}
}
}
示例5: draw
/**
* Draw the given bitmap to the LED matrix.
*
* @param addr the address of the display to control
* @param bitmap Bitmap to draw
* @throws IOException
*/
public void draw(int addr, Bitmap bitmap) throws IOException {
if (addr < 0 || addr >= maxDevices) {
return;
}
Bitmap scaled = Bitmap.createScaledBitmap(bitmap, 8, 8, true);
for (int row = 0; row < 8; row++) {
int value = 0;
for (int col = 0; col < 8; col++) {
value |= scaled.getPixel(col, row) == Color.WHITE ? (0x80 >> col) : 0;
}
setRow(addr, row, (byte) value);
}
}
示例6: startElement
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
String tagName = localName.length() != 0 ? localName : qName;
tagName = tagName.toLowerCase(Locale.getDefault()).trim();
if (tagName.equals("d")) {
// <d p="23.826000213623,1,25,16777215,1422201084,0,057075e9,757076900">我从未见过如此厚颜无耻之猴</d>
// 0:时间(弹幕出现时间)
// 1:类型(1从右至左滚动弹幕|6从左至右滚动弹幕|5顶端固定弹幕|4底端固定弹幕|7高级弹幕|8脚本弹幕)
// 2:字号
// 3:颜色
// 4:时间戳 ?
// 5:弹幕池id
// 6:用户hash
// 7:弹幕id
String pValue = attributes.getValue("p");
// parse p value to danmaku
String[] values = pValue.split(",");
if (values.length > 0) {
long time = (long) (Float.parseFloat(values[0]) * 1000); // 出现时间
int type = Integer.parseInt(values[1]); // 弹幕类型
float textSize = Float.parseFloat(values[2]); // 字体大小
int color = (int) ((0x00000000ff000000 | Long.parseLong(values[3])) & 0x00000000ffffffff); // 颜色
// int poolType = Integer.parseInt(values[5]); // 弹幕池类型(忽略
item = mContext.mDanmakuFactory.createDanmaku(type, mContext);
if (item != null) {
item.setTime(time);
item.textSize = textSize * (mDispDensity - 0.6f);
item.textColor = color;
item.textShadowColor = color <= Color.BLACK ? Color.WHITE : Color.BLACK;
}
}
}
}
示例7: initPaint
private Paint initPaint(int alpha) {
paint = new Paint();
paint.setAntiAlias(true);// �����
//paint.setStyle(Paint.Style.FILL);// ���
paint.setAlpha(alpha);// ����
//paint.setColor(Color.RED);// ��ɫ
Shader mShader = new LinearGradient(0, 0, 200, 200,
new int[]{Color.GREEN, Color.WHITE},
null, Shader.TileMode.REPEAT);
paint.setShader(mShader);
return paint;
}
示例8: createRipple
public static RippleDrawable createRipple(@NonNull Palette palette,
@FloatRange(from = 0f, to = 1f) float darkAlpha,
@FloatRange(from = 0f, to = 1f) float lightAlpha,
@ColorInt int fallbackColor,
boolean bounded) {
int rippleColor = fallbackColor;
if (palette != null) {
// try the named swatches in preference order
if (palette.getVibrantSwatch() != null) {
rippleColor =
ColorUtils.modifyAlpha(palette.getVibrantSwatch().getRgb(), darkAlpha);
} else if (palette.getLightVibrantSwatch() != null) {
rippleColor = ColorUtils.modifyAlpha(palette.getLightVibrantSwatch().getRgb(),
lightAlpha);
} else if (palette.getDarkVibrantSwatch() != null) {
rippleColor = ColorUtils.modifyAlpha(palette.getDarkVibrantSwatch().getRgb(),
darkAlpha);
} else if (palette.getMutedSwatch() != null) {
rippleColor = ColorUtils.modifyAlpha(palette.getMutedSwatch().getRgb(), darkAlpha);
} else if (palette.getLightMutedSwatch() != null) {
rippleColor = ColorUtils.modifyAlpha(palette.getLightMutedSwatch().getRgb(),
lightAlpha);
} else if (palette.getDarkMutedSwatch() != null) {
rippleColor =
ColorUtils.modifyAlpha(palette.getDarkMutedSwatch().getRgb(), darkAlpha);
}
}
return new RippleDrawable(ColorStateList.valueOf(rippleColor), null,
bounded ? new ColorDrawable(Color.WHITE) : null);
}
示例9: init
private void init() {
mDensity = getResources().getDisplayMetrics().density;
mProgressColor = Color.WHITE;
mBackColor = Color.parseColor("#474430");
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setStrokeCap(Paint.Cap.ROUND);
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.STROKE);
strokeWidth = mDensity * 2;
mPaint.setStrokeWidth(strokeWidth);
}
示例10: getStartColor
private int getStartColor(Integer[] colors) {
Integer startColor = getStartOffset(colors);
return startColor == null ? Color.WHITE : colors[startColor];
}
示例11: onTouchEvent
@Override
public boolean onTouchEvent(MotionEvent event) {
getParent().requestDisallowInterceptTouchEvent(true);
// Convert coordinates to our internal coordinate system
float dimen;
if (mOrientation == ORIENTATION_HORIZONTAL) {
dimen = event.getX();
}
else {
dimen = event.getY();
}
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mIsMovingPointer = true;
// Check whether the user pressed on (or near) the pointer
if (dimen >= (mBarPointerHaloRadius)
&& dimen <= (mBarPointerHaloRadius + mBarLength)) {
mBarPointerPosition = Math.round(dimen);
calculateColor(Math.round(dimen));
mBarPointerPaint.setColor(mColor);
invalidate();
}
break;
case MotionEvent.ACTION_MOVE:
if (mIsMovingPointer) {
// Move the the pointer on the bar.
if (dimen >= mBarPointerHaloRadius
&& dimen <= (mBarPointerHaloRadius + mBarLength)) {
mBarPointerPosition = Math.round(dimen);
calculateColor(Math.round(dimen));
mBarPointerPaint.setColor(mColor);
if (mPicker != null) {
mPicker.setNewCenterColor(mColor);
mPicker.changeValueBarColor(mColor);
mPicker.changeOpacityBarColor(mColor);
}
invalidate();
} else if (dimen < mBarPointerHaloRadius) {
mBarPointerPosition = mBarPointerHaloRadius;
mColor = Color.WHITE;
mBarPointerPaint.setColor(mColor);
if (mPicker != null) {
mPicker.setNewCenterColor(mColor);
mPicker.changeValueBarColor(mColor);
mPicker.changeOpacityBarColor(mColor);
}
invalidate();
} else if (dimen > (mBarPointerHaloRadius + mBarLength)) {
mBarPointerPosition = mBarPointerHaloRadius + mBarLength;
mColor = Color.HSVToColor(mHSVColor);
mBarPointerPaint.setColor(mColor);
if (mPicker != null) {
mPicker.setNewCenterColor(mColor);
mPicker.changeValueBarColor(mColor);
mPicker.changeOpacityBarColor(mColor);
}
invalidate();
}
}
if(onSaturationChangedListener != null && oldChangedListenerSaturation != mColor){
onSaturationChangedListener.onSaturationChanged(mColor);
oldChangedListenerSaturation = mColor;
}
break;
case MotionEvent.ACTION_UP:
mIsMovingPointer = false;
break;
}
return true;
}
示例12: getDefaultIconColor
public int getDefaultIconColor() {
return Color.WHITE;
}
示例13: getBackgroundColor
@Override
public int getBackgroundColor() {
return Color.WHITE;
}
示例14: parseAttrs
/**
* This method initiates the bottomNavigationBar properties,
* Tries to get them form XML if not preset sets them to their default values.
*
* @param context context of the bottomNavigationBar
* @param attrs attributes mentioned in the layout XML by user
*/
private void parseAttrs(Context context, AttributeSet attrs) {
if (attrs != null) {
TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.BottomNavigationBar, 0, 0);
mActiveColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbActiveColor, Utils.fetchContextColor(context, R.attr.colorAccent));
mInActiveColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbInactiveColor, Color.LTGRAY);
mBackgroundColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbBackgroundColor, Color.WHITE);
mAutoHideEnabled = typedArray.getBoolean(R.styleable.BottomNavigationBar_bnbAutoHideEnabled, true);
mElevation = typedArray.getDimension(R.styleable.BottomNavigationBar_bnbElevation, getResources().getDimension(R.dimen.bottom_navigation_elevation));
setAnimationDuration(typedArray.getInt(R.styleable.BottomNavigationBar_bnbAnimationDuration, DEFAULT_ANIMATION_DURATION));
switch (typedArray.getInt(R.styleable.BottomNavigationBar_bnbMode, MODE_DEFAULT)) {
case MODE_FIXED:
mMode = MODE_FIXED;
break;
case MODE_SHIFTING:
mMode = MODE_SHIFTING;
break;
case MODE_FIXED_NO_TITLE:
mMode = MODE_FIXED_NO_TITLE;
break;
case MODE_SHIFTING_NO_TITLE:
mMode = MODE_SHIFTING_NO_TITLE;
break;
case MODE_DEFAULT:
default:
mMode = MODE_DEFAULT;
break;
}
switch (typedArray.getInt(R.styleable.BottomNavigationBar_bnbBackgroundStyle, BACKGROUND_STYLE_DEFAULT)) {
case BACKGROUND_STYLE_STATIC:
mBackgroundStyle = BACKGROUND_STYLE_STATIC;
break;
case BACKGROUND_STYLE_RIPPLE:
mBackgroundStyle = BACKGROUND_STYLE_RIPPLE;
break;
case BACKGROUND_STYLE_DEFAULT:
default:
mBackgroundStyle = BACKGROUND_STYLE_DEFAULT;
break;
}
typedArray.recycle();
} else {
mActiveColor = Utils.fetchContextColor(context, R.attr.colorAccent);
mInActiveColor = Color.LTGRAY;
mBackgroundColor = Color.WHITE;
mElevation = getResources().getDimension(R.dimen.bottom_navigation_elevation);
}
}
示例15: Bauernkrieg
public Bauernkrieg()
{
super(Color.rgb(20, 80, 0), Color.WHITE, BoardType.VERT_FULL, windowZoom(600));
}