本文整理汇总了Java中android.graphics.Color.DKGRAY属性的典型用法代码示例。如果您正苦于以下问题:Java Color.DKGRAY属性的具体用法?Java Color.DKGRAY怎么用?Java Color.DKGRAY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.graphics.Color
的用法示例。
在下文中一共展示了Color.DKGRAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: OptionsAdapter
public OptionsAdapter(Context context, @Nullable int[] iconsID, @Nullable int[] ids, @NonNull String[] texts, @Nullable String[] msgs, @Nullable OptionClickListener[] listener) {
this.context = context;
this.iconColor = this.titleColor = Color.DKGRAY;
this.msgColor = Color.GRAY;
for (int i = 0; i < texts.length; i++) {
Option option = new Option(
texts[i],
ids == null ? 0 : (ids.length == texts.length ? ids[i] : 0),
msgs == null ? null : msgs[i],
iconsID == null ? -1 : iconsID[i],
listener == null ? null : listener[i]
);
options.add(option);
}
}
示例2: onSizeChanged
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (mViewWidth == 0) {
mViewWidth = getMeasuredWidth();
if (mViewWidth > 0) {
mPaint = getPaint();
mLinearGradient = new LinearGradient(
0,
0,
mViewWidth,
0,
new int[]{
Color.DKGRAY, 0xffffffff,
Color.DKGRAY
},
null,
Shader.TileMode.CLAMP);
mPaint.setShader(mLinearGradient);
mGradientMatrix = new Matrix();
}
}
}
示例3: init
private void init() {
radius = oneDp;
contactWidth = oneDp;
batteryColor = Color.DKGRAY;
paintFrame = new Paint();
paintSolid = new Paint();
paintFrame.setColor(batteryColor);
paintFrame.setStyle(Paint.Style.STROKE);
// 电池边框
paintFrame.setStrokeWidth(oneDp * 1);
paintSolid.setColor(batteryColor);
setBatteryLevel(0.8f);
}
示例4: getRandomColor
public int getRandomColor() {
Random random = new Random();
switch (random.nextInt(10)) {
case 0:
return Color.WHITE;
case 1:
return Color.BLACK;
case 2:
return Color.BLUE;
case 3:
return Color.CYAN;
case 4:
return Color.YELLOW;
case 5:
return Color.GREEN;
case 6:
return Color.RED;
case 7:
return Color.GRAY;
case 8:
return Color.LTGRAY;
case 9:
return Color.DKGRAY;
default:
return Color.MAGENTA;
}
}
示例5: decodeColor
/**
* Converts an ARGB hex color String value to an Android Integer color value.
* <br>
* Supported formats:
* <br>
* <ul>
* <li>#aaRRggBb</li>
* <li>0xaaRRggBb</li>
* <li>0XaaRRggBb</li>
* <li>#RRggBb</li>
* <li>0xRRggBb</li>
* <li>0XRRggBb</li>
* </ul>
* <i>* Plus all caps variants.</i>
*
* @param hexValue Hex value
* @return Integer color, or {@link Color#DKGRAY} if something goes wrong
*/
@ColorInt
public static int decodeColor(@NonNull final String hexValue) {
if (SillyAndroid.isEmpty(hexValue)) {
return Color.DKGRAY;
}
String colorHex = hexValue.trim();
colorHex = colorHex.replace("#", "").replace("0x", "").replace("0X", "");
final int length = colorHex.length();
if (length != 6 && length != 8) {
return Color.DKGRAY;
}
int alpha = 255;
final int red;
final int green;
final int blue;
try {
if (length == 8) {
alpha = Integer.parseInt(colorHex.substring(0, 2), 16);
red = Integer.parseInt(colorHex.substring(2, 4), 16);
green = Integer.parseInt(colorHex.substring(4, 6), 16);
blue = Integer.parseInt(colorHex.substring(6, 8), 16);
} else {
red = Integer.parseInt(colorHex.substring(0, 2), 16);
green = Integer.parseInt(colorHex.substring(2, 4), 16);
blue = Integer.parseInt(colorHex.substring(4, 6), 16);
}
return Color.argb(alpha, red, green, blue);
} catch (Throwable ignored) {
return Color.DKGRAY;
}
}
示例6: enableOutline
private void enableOutline(boolean enabled) {
findViewById(R.id.text_outline_size).setEnabled(enabled);
findViewById(R.id.edit_outline_size).setEnabled(enabled);
findViewById(R.id.text_outline_color).setEnabled(enabled);
findViewById(R.id.edit_outline_color).setEnabled(enabled);
@ColorInt
int color = enabled ? mLabel.getOutlineColor() : Color.DKGRAY;
findViewById(R.id.edit_outline_color).setBackgroundColor(color);
}
示例7: getChildAt
/**
* Draw layout bounds for the next child.
*
* @param canvas The canvas to draw on.
*/
/* package */ void debugDrawNextChild(Canvas canvas) {
View child = getChildAt(mDrawChildIndex);
// Draw FlatViewGroups a different color than regular child views.
int color = child instanceof FlatViewGroup ? Color.DKGRAY : Color.RED;
debugDrawRect(
canvas,
color,
child.getLeft(),
child.getTop(),
child.getRight(),
child.getBottom());
++mDrawChildIndex;
}
示例8: cvtStr2Color
public static int cvtStr2Color(String str) {
if (str.trim().toLowerCase(Locale.US).equals("blue")) {
return Color.BLUE;
} else if (str.trim().toLowerCase(Locale.US).equals("cyan")) {
return Color.CYAN;
} else if (str.trim().toLowerCase(Locale.US).equals("dkgray")) {
return Color.DKGRAY;
} else if (str.trim().toLowerCase(Locale.US).equals("gray")) {
return Color.GRAY;
} else if (str.trim().toLowerCase(Locale.US).equals("green")) {
return Color.GREEN;
} else if (str.trim().toLowerCase(Locale.US).equals("ltgray")) {
return Color.LTGRAY;
} else if (str.trim().toLowerCase(Locale.US).equals("magenta")) {
return Color.MAGENTA;
/*} else if (str.trim().toLowerCase(Locale.US).equals("orange")) {
return Color.ORANGE; // Pink and orange are not predefined colors in Android
} else if (str.trim().toLowerCase(Locale.US).equals("pink")) {
return Color.PINK; */
} else if (str.trim().toLowerCase(Locale.US).equals("red")) {
return Color.RED;
} else if (str.trim().toLowerCase(Locale.US).equals("white")) {
return Color.WHITE;
} else if (str.trim().toLowerCase(Locale.US).equals("yellow")) {
return Color.YELLOW;
} else {
return Color.BLACK;
}
}
示例9: cvtStr2Color
public static int cvtStr2Color(String str) {
if (str.trim().toLowerCase(Locale.US).equals("blue")) {
return Color.BLUE;
} else if (str.trim().toLowerCase(Locale.US).equals("cyan")) {
return Color.CYAN;
} else if (str.trim().toLowerCase(Locale.US).equals("dkgray")) {
return Color.DKGRAY;
} else if (str.trim().toLowerCase(Locale.US).equals("gray")) {
return Color.GRAY;
} else if (str.trim().toLowerCase(Locale.US).equals("green")) {
return Color.GREEN;
} else if (str.trim().toLowerCase(Locale.US).equals("ltgray")) {
return Color.LTGRAY;
} else if (str.trim().toLowerCase(Locale.US).equals("magenta")) {
return Color.MAGENTA;
} else if (str.trim().toLowerCase(Locale.US).equals("red")) {
return Color.RED;
} else if (str.trim().toLowerCase(Locale.US).equals("transparent")) {
return Color.TRANSPARENT;
} else if (str.trim().toLowerCase(Locale.US).equals("white")) {
return Color.WHITE;
} else if (str.trim().toLowerCase(Locale.US).equals("yellow")) {
return Color.YELLOW;
} else {
return Color.BLACK;
}
}
示例10: ItemData
public ItemData(int icon, String title) {
this(Color.DKGRAY, icon, title, new Date());
}
示例11: onBindViewHolder
@Override
public void onBindViewHolder(final BasicListAdapter.ViewHolder holder, final int position) {
ToDoItem item = items.get(position);
// if(item.getToDoDate()!=null && item.getToDoDate().before(new Date())){
// item.setToDoDate(null);
// }
SharedPreferences sharedPreferences = getSharedPreferences(THEME_PREFERENCES, MODE_PRIVATE);
//Background color for each to-do item. Necessary for night/day mode
int bgColor;
//color of title text in our to-do item. White for night mode, dark gray for day mode
int todoTextColor;
if(sharedPreferences.getString(THEME_SAVED, LIGHTTHEME).equals(LIGHTTHEME)){
bgColor = Color.WHITE;
todoTextColor = getResources().getColor(R.color.secondary_text);
}
else{
bgColor = Color.DKGRAY;
todoTextColor = Color.WHITE;
}
holder.linearLayout.setBackgroundColor(bgColor);
if(item.hasReminder() && item.getToDoDate()!=null){
holder.mToDoTextview.setMaxLines(1);
holder.mTimeTextView.setVisibility(View.VISIBLE);
// holder.mToDoTextview.setVisibility(View.GONE);
}
else{
holder.mTimeTextView.setVisibility(View.GONE);
holder.mToDoTextview.setMaxLines(2);
}
holder.mToDoTextview.setText(item.getToDoText());
holder.mToDoTextview.setTextColor(todoTextColor);
// holder.mColorTextView.setBackgroundColor(Color.parseColor(item.getTodoColor()));
// TextDrawable myDrawable = TextDrawable.builder().buildRoundRect(item.getToDoText().substring(0,1),Color.RED, 10);
//We check if holder.color is set or not
// if(item.getTodoColor() == null){
// ColorGenerator generator = ColorGenerator.MATERIAL;
// int color = generator.getRandomColor();
// item.setTodoColor(color+"");
// }
// Log.d("OskarSchindler", "Color: "+item.getTodoColor());
TextDrawable myDrawable = TextDrawable.builder().beginConfig()
.textColor(Color.WHITE)
.useFont(Typeface.DEFAULT)
.toUpperCase()
.endConfig()
.buildRound(item.getToDoText().substring(0,1),item.getTodoColor());
// TextDrawable myDrawable = TextDrawable.builder().buildRound(item.getToDoText().substring(0,1),holder.color);
holder.mColorImageView.setImageDrawable(myDrawable);
if(item.getToDoDate()!=null){
String timeToShow;
if(android.text.format.DateFormat.is24HourFormat(MainActivity.this)){
timeToShow = AddToDoActivity.formatDate(MainActivity.DATE_TIME_FORMAT_24_HOUR, item.getToDoDate());
}
else{
timeToShow = AddToDoActivity.formatDate(MainActivity.DATE_TIME_FORMAT_12_HOUR, item.getToDoDate());
}
holder.mTimeTextView.setText(timeToShow);
}
}
示例12: ShimmerSpan
public ShimmerSpan() {
colors = new int[3];
colors[0] = Color.WHITE;
colors[1] = Color.LTGRAY;
colors[2] = Color.DKGRAY;
}
示例13: getBackGroundColors
public int[] getBackGroundColors() {
return new int[]{Color.DKGRAY,Color.rgb(50,50,50)};
}
示例14: Builder
public Builder() {
view = new QuantityDataView();
view.selectorColor = Color.BLACK;
view.smallSelectorColor = Color.DKGRAY;
}
示例15: getThemeDarkColor
@Override
public int getThemeDarkColor() {
return Color.DKGRAY;
}