本文整理汇总了Java中android.graphics.Color.BLUE属性的典型用法代码示例。如果您正苦于以下问题:Java Color.BLUE属性的具体用法?Java Color.BLUE怎么用?Java Color.BLUE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.graphics.Color
的用法示例。
在下文中一共展示了Color.BLUE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: spanTest
private void spanTest() {
SpannableString spannableString = new SpannableString("欢迎光临我的博客");
// 字体颜色span
ForegroundColorSpan colorSpan = new ForegroundColorSpan(Color.BLUE);
// 背景颜色span
BackgroundColorSpan backgroundColorSpan = new BackgroundColorSpan(Color.RED);
// 1,3其实是两个位置,末尾不包括
// Flag 为 span如果新增了文字 的前面不包括样式,后面包括样式
spannableString.setSpan(colorSpan, 1, 3, Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
spannableString.setSpan(backgroundColorSpan, 5, 7, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
spannableStringBuilder.append(spannableString);
editText.setText(spannableString);
}
示例2: initValues
private void initValues(@NonNull Context context, boolean editMode) {
mBorderWidth = context.getResources().getDimension(R.dimen.cpb_default_stroke_width);
mSweepSpeed = 1f;
mRotationSpeed = 1f;
if (editMode) {
mColors = new int[]{Color.BLUE};
mMinSweepAngle = 20;
mMaxSweepAngle = 300;
} else {
mColors = new int[]{context.getResources().getColor(R.color.cpb_default_color)};
mMinSweepAngle = context.getResources().getInteger(R.integer.cpb_default_min_sweep_angle);
mMaxSweepAngle = context.getResources().getInteger(R.integer.cpb_default_max_sweep_angle);
}
mStyle = CircularProgressDrawable.STYLE_ROUNDED;
mPowerManager = Utils.powerManager(context);
}
示例3: testFallbackDrawableSetOnNullModelWithErrorAndFallbackDrawables
@Test
public void testFallbackDrawableSetOnNullModelWithErrorAndFallbackDrawables() {
Drawable placeholder = new ColorDrawable(Color.RED);
Drawable errorPlaceholder = new ColorDrawable(Color.GREEN);
Drawable fallback = new ColorDrawable(Color.BLUE);
MockTarget target = new MockTarget();
harness.placeholderDrawable = placeholder;
harness.errorDrawable = errorPlaceholder;
harness.fallbackDrawable = fallback;
harness.target = target;
harness.model = null;
SingleRequest<List> request = harness.getRequest();
request.begin();
assertEquals(fallback, target.currentPlaceholder);
}
示例4: setUp
@Before
public void setUp() {
mBuilder = new GenericDraweeHierarchyBuilder(null);
mBackground = DrawableTestUtils.mockDrawable();
mOverlay1 = DrawableTestUtils.mockDrawable();
mOverlay2 = DrawableTestUtils.mockDrawable();
mPlaceholderImage = DrawableTestUtils.mockBitmapDrawable();
mFailureImage = DrawableTestUtils.mockBitmapDrawable();
mRetryImage = DrawableTestUtils.mockBitmapDrawable();
mProgressBarImage = DrawableTestUtils.mockBitmapDrawable();
mActualImage1 = DrawableTestUtils.mockBitmapDrawable();
mActualImage2 = DrawableTestUtils.mockBitmapDrawable();
mWrappedLeaf = new ColorDrawable(Color.BLUE);
mWrappedImage = new ForwardingDrawable(new ForwardingDrawable(mWrappedLeaf));
mFocusPoint = new PointF(0.1f, 0.4f);
}
示例5: UIProgressView
public UIProgressView(Context context, int style) {
super(context, R.style.ProgressViewDialogStyle);
this.mStyle = style;
this.mContext = context;
this.textColor = context.getResources().getColor(R.color.colorLoadingText);
this.loadingColor = Color.BLUE;
this.window = getWindow();
this.lp = window.getAttributes();
if (mStyle == STYLE_WEI_BO) {//微博样式
mIndeterminateDrawable = mContext.getResources().getDrawable(R.drawable.dialog_loading_wei_bo);
textColor = mContext.getResources().getColor(R.color.colorLoadingTextWeiBo);
} else if (mStyle == STYLE_WEI_XIN) {//微信样式
mIndeterminateDrawable = mContext.getResources().getDrawable(R.drawable.dialog_loading_wei_xin);
textColor = Color.WHITE;
} else if (mStyle == STYLE_MATERIAL_DESIGN) {
textColor = loadingColor;
}
window.setWindowAnimations(R.style.PopWindowAnimStyle);
setContentView(R.layout.layout_progress_view);
initView();
}
示例6: getColor
private int getColor(@NonNull Piece piece) {
switch (piece) {
case T:
return Color.GREEN;
case L:
return Color.RED;
case Z:
return Color.YELLOW;
case S:
return Color.BLUE;
case LL:
return Color.MAGENTA;
default:
return Color.CYAN;
}
}
示例7: getColor
public static @ColorInt int getColor(int index) {
int color = Color.TRANSPARENT;
switch (index) {
case 0:
color = R.color.color0;
break;
case 1:
color = Color.BLUE;
break;
case 2:
color = Color.GRAY;
break;
}
return color;
}
示例8: init
private void init() {
mTextPaint = new TextPaint();
mTextPaint.setAntiAlias(true);
mTextPaint.setColor(mTextColor);
if (mTextSizePx <= 0) {
mTextSizePx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
DEFAULT_FONT_SIZE_SP, getResources().getDisplayMetrics());
}
mTextPaint.setTextSize(mTextSizePx);
mTypeface = MongolFont.get(MongolFont.QAGAN, mContext);
mTextPaint.setTypeface(mTypeface);
mTextPaint.linkColor = Color.BLUE;
// initialize the layout, but the height still needs to be set
final CharSequence text = mTextStorage.getGlyphText();
mLayout = new MongolLayout(text, 0, text.length(), mTextPaint, 0, Gravity.TOP, 1, 0, false, Integer.MAX_VALUE);
}
示例9: createSet
private LineDataSet createSet(String label) {
LineDataSet set = new LineDataSet(null, label);
set.setAxisDependency(YAxis.AxisDependency.LEFT);
int color;
if (label.equals(pm1Label)) {
color = Color.BLUE;
} else if (label.equals(pm25Label)) {
color = Color.RED;
} else {
color = Color.BLACK;
}
set.setColor(color);
set.setLineWidth(2f);
set.setDrawValues(false);
set.setDrawCircles(false);
set.setMode(LineDataSet.Mode.LINEAR);
return set;
}
示例10: init
private void init() {
this.mPaint = new Paint();
this.mPaint.setAntiAlias(true);
this.mStartedLineColor = Color.BLUE;
this.mPreLineColor = Color.GRAY;
this.mStartedCircleColor = mStartedLineColor;
this.mUnderwayCircleColor = mStartedCircleColor;
this.mPreCircleColor = mPreLineColor;
this.mStartedStringColor = mStartedLineColor;
this.mUnderwayStringColor = mStartedStringColor;
this.mPreStringColor = mPreLineColor;
this.mPointTxt = new ArrayList();
this.mPointTxt.add("step 1");
this.mPointTxt.add("step 2");
this.mPointTxt.add("step 3");
this.mBuilder = new Builder();
}
示例11: renderItemNumber
public static void renderItemNumber(SpannableStringBuilder builder) {
String string = builder.toString();
if (!string.contains("、")
|| !isNumeric(string.substring(0, string.indexOf("、")))) {
return;
}
ForegroundColorSpan numSpan = new ForegroundColorSpan(Color.BLUE);
builder.setSpan(numSpan, 0, string.indexOf("、"),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
示例12: testNullModelPrefersFallbackDrawable
@Test
public void testNullModelPrefersFallbackDrawable() {
Drawable placeholder = new ColorDrawable(Color.GREEN);
Drawable error = new ColorDrawable(Color.RED);
Drawable fallback = new ColorDrawable(Color.BLUE);
requestManager
.load(null)
.apply(placeholderOf(placeholder)
.error(error)
.fallback(fallback))
.into(target);
verify(target).onLoadFailed(eq(fallback));
}
示例13: drawTrainingCircle
public void drawTrainingCircle(int stepX, int stepY) {
int dx = (width - xOffset * 2) / 6;
int dy = (height - yOffset * 2) / 5;
int x = xOffset + stepX *dx + dx / 2;
int y = yOffset + stepY *dy + dy / 2;
RadialGradient gradient = new RadialGradient(x, y, 200,
Color.TRANSPARENT, Color.BLUE, Shader.TileMode.CLAMP);
Paint p = new Paint();
p.setDither(true);
p.setShader(gradient);
canvas.drawCircle(x, y, 200, p);
}
示例14: onItemSelected
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
// An item was selected. You can retrieve the selected item using
// parent.getItemAtPosition(pos)
int viewid = parent.getId();
if (viewid == R.id.fontcolor_spinner) {
int color = Color.BLACK;
String item = String.valueOf(parent.getItemAtPosition(pos));
switch (item) {
case "BLUE":
color = Color.BLUE;
break;
case "RED":
color = Color.RED;
break;
case "YELLOW":
color = Color.YELLOW;
break;
}
mMongolLabelMatchParent.setTextColor(color);
mMongolLabelWrapContent.setTextColor(color);
} else if (viewid == R.id.fontsize_spinner) {
int size = Integer.parseInt(parent.getSelectedItem().toString());
mMongolLabelMatchParent.setTextSize(size);
mMongolLabelWrapContent.setTextSize(size);
// } else if (viewid == R.id.alignment_spinner) {
// int gravity = Gravity.TOP;
// String item = String.valueOf(parent.getItemAtPosition(pos));
// switch (item) {
// case "CENTER":
// gravity = Gravity.CENTER;
// break;
// case "BOTTOM":
// gravity = Gravity.BOTTOM;
// break;
// }
// mMongolLabelMatchParent.setGravity(gravity);
// mMongolLabelWrapContent.setGravity(gravity);
}
}
示例15: init
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
if (!isInEditMode()) {
}
rect = new Rect();
paint = new Paint();
doorRect = new Rect();
doorPaint = new Paint();
doorPaint.setColor(Color.WHITE);
int buildingsColor = Color.BLUE;
if (attrs != null) {
boolean containsBuildColor = containsBuildColor(attrs);
if (containsBuildColor) {
buildingsColor = loadColorAttribute(context, attrs, defStyleAttr, buildingsColor, R.styleable.BuildingView, defStyleRes,
R.styleable.BuildingView_building_color);
} else {
buildingsColor = loadColorAttribute(context, attrs, defStyleAttr, buildingsColor, R.styleable.CityView, R.style.CityViewTheme,
R.styleable.CityView_buildings_color);
}
}
paint.setColor(buildingsColor);
loadDimensions(context, attrs, defStyleAttr, defStyleRes);
}