本文整理汇总了Java中android.graphics.Color.GRAY属性的典型用法代码示例。如果您正苦于以下问题:Java Color.GRAY属性的具体用法?Java Color.GRAY怎么用?Java Color.GRAY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.graphics.Color
的用法示例。
在下文中一共展示了Color.GRAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initRecycleView
private void initRecycleView() {
recyclerView.setLayoutManager(new LinearLayoutManager(this));
adapter = new SimpleRvAdapter();
recyclerView.setAdapter(adapter);
adapter.showLoading();
recyclerView.postDelayed(new Runnable() {
@Override
public void run() {
adapter.hideLoading();
List<FiveBean> fiveBeen = mockMoreData();
adapter.setData(getCells(fiveBeen));
}
},2000);
RecycleViewItemLine line = new RecycleViewItemLine(this,LinearLayoutManager.HORIZONTAL,2, Color.GRAY);
recyclerView.addItemDecoration(line);
}
示例2: 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;
}
示例3: Options
public Options() {
mHeaderSizes = new float[] {
1.5f, // h1
1.4f, // h2
1.3f, // h3
1.2f, // h4
1.1f, // h5
1.0f, // h6
};
mUnorderedListItem = "\u2022";
mListItemIndentUnit = TypedValue.COMPLEX_UNIT_DIP;
mListItemIndentSize = 10;
mBlockQuoteColor = 0xff0000ff;
mBlockQuoteIndentUnit = TypedValue.COMPLEX_UNIT_DIP;
mBlockQuoteIndentSize = 10;
mCodeBlockIndentUnit = TypedValue.COMPLEX_UNIT_DIP;
mCodeBlockIndentSize = 10;
mHruleColor = Color.GRAY;
mHruleUnit = TypedValue.COMPLEX_UNIT_DIP;
mHruleSize = 1;
}
示例4: bindImageAndForeground
@RequiresApi(api = Build.VERSION_CODES.M)
private void bindImageAndForeground(View image, Bitmap bitmap) {
if (bitmap == null) {
bitmap = BitmapUtils.bitmapResizeFromResource(context.getResources(), R.drawable.default_song, imageWidth, imageHeight);
}
int defaultTC = Color.WHITE;
int defaultBC = Color.GRAY;
int[] colors = new int[4];
ColorUtils.get4LightColorWithTextFormBitmap(bitmap, defaultBC, defaultTC, colors);
int color = colors[0];
color = color == defaultBC ? colors[2] : color;
color = android.support.v4.graphics.ColorUtils.setAlphaComponent(color, 255);
GradientDrawable dra = new GradientDrawable(
GradientDrawable.Orientation.LEFT_RIGHT,
new int[]{color, Color.TRANSPARENT});
dra.setGradientType(GradientDrawable.LINEAR_GRADIENT);
image.setBackground(dra);
}
示例5: Attributes
public Attributes(Context context) {
mContext = context;
this.background = new ColorDrawable(Color.TRANSPARENT);
this.cancelButtonBackground = new ColorDrawable(Color.BLACK);
ColorDrawable gray = new ColorDrawable(Color.GRAY);
this.otherButtonTopBackground = gray;
this.otherButtonMiddleBackground = gray;
this.otherButtonBottomBackground = gray;
this.otherButtonSingleBackground = gray;
this.cancelButtonTextColor = Color.WHITE;
this.otherButtonTextColor = Color.BLACK;
this.padding = dp2px(20);
this.otherButtonSpacing = dp2px(2);
this.cancelButtonMarginTop = dp2px(10);
this.actionSheetTextSize = dp2px(16);
}
示例6: setDefaultNumKey
private void setDefaultNumKey(TextView view, int key) {
view.setText(String.valueOf(key));
if (null != mNumBgDrawSelector) {
Drawable tempNumBg = mNumBgDrawSelector.getConstantState()
.newDrawable();
view.setBackgroundDrawable(tempNumBg);
} else {
ColorDrawable normal = new ColorDrawable(Color.WHITE);
ColorDrawable press = new ColorDrawable(Color.GRAY);
view.setBackgroundDrawable(getDrawableSeletor(normal, press));
}
}
示例7: Builder
private Builder() {
text = "";
color = Color.GRAY;
textColor = Color.WHITE;
borderThickness = 0;
width = -1;
height = -1;
shape = new RectShape();
font = Typeface.create("sans-serif-light", Typeface.NORMAL);
fontSize = -1;
isBold = false;
toUpperCase = false;
}
示例8: setSelectionColor
/**
* @param color The selection color
*/
public void setSelectionColor(int color) {
if (color == 0) {
if (!isInEditMode()) {
return;
} else {
color = Color.GRAY;
}
}
accentColor = color;
adapter.setSelectionColor(color);
invalidate();
}
示例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("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;
}
}
示例10: 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;
}
}
示例11: initRecycleView
private void initRecycleView() {
recyclerView.setLayoutManager(new LinearLayoutManager(this));
adapter = new SecondAdapter(this,this);
recyclerView.setAdapter(adapter);
adapter.setData(list);
RecycleViewItemLine line = new RecycleViewItemLine(this,LinearLayoutManager.HORIZONTAL,2, Color.GRAY);
recyclerView.addItemDecoration(line);
}
示例12: getRandomMaterialColor
private int getRandomMaterialColor() {
int returnColor = Color.GRAY;
int arrayId = context.getResources().getIdentifier("mdcolor_400", "array", context.getPackageName());
if (arrayId != 0) {
TypedArray colors = context.getResources().obtainTypedArray(arrayId);
int index = (int) (Math.random() * colors.length());
returnColor = colors.getColor(index, Color.GRAY);
colors.recycle();
}
return returnColor;
}
示例13: 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;
}
}
示例14: initDefault
private void initDefault() {
//mDisplayText = "abc";
//mKeyColor = Color.LTGRAY;
mPressedColor = Color.GRAY;
//mTextColor = Color.BLACK;
//mBorderColor = Color.BLACK;
//mBorderWidth = 10;
//mBorderRadius = 30;
}
示例15: init
private void init(Context context,AttributeSet attrs){
View view = inflate(context,R.layout.nav_item,this);
ButterKnife.bind(view);
//自定义视图属性
TypedArray typedArray = context.obtainStyledAttributes(attrs,R.styleable.NavItem);
String action = typedArray.getString(R.styleable.NavItem_action);
String actionState = typedArray.getString(R.styleable.NavItem_actionState);
if (actionState != null){
mTvActionState.setText(actionState);
}
mTvActionTitle.setText(action != null ? action:"");
int startIcon = typedArray.getResourceId(R.styleable.NavItem_startIcon,0);
if (startIcon != 0){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ){
mIvStartIcon.setImageDrawable(context.getResources().getDrawable(startIcon,context.getTheme()));
}else {
mIvStartIcon.setImageDrawable(context.getResources().getDrawable(startIcon));
}
}
int color = typedArray.getColor(R.styleable.NavItem_textColor, Color.GRAY);
if (color != Color.GRAY){
mTvActionTitle.setTextColor(color);
mTvActionState.setTextColor(color);
}
int tint = typedArray.getColor(R.styleable.NavItem_tint,Color.TRANSPARENT);
if (tint != Color.TRANSPARENT){
mIvStartIcon.setImageTintList(ColorStateList.valueOf(tint));
}
typedArray.recycle();
}