当前位置: 首页>>代码示例>>Java>>正文


Java Color.BLACK属性代码示例

本文整理汇总了Java中android.graphics.Color.BLACK属性的典型用法代码示例。如果您正苦于以下问题:Java Color.BLACK属性的具体用法?Java Color.BLACK怎么用?Java Color.BLACK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.graphics.Color的用法示例。


在下文中一共展示了Color.BLACK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initAttrs

private void initAttrs(Context context, AttributeSet attrs) {
    borderColor = Color.BLACK;
    backgroundColor = Color.WHITE;
    orientation = LEFT;
    borderWidth = DensityUtils.dip2px(context, 2);
    radius = DensityUtils.dip2px(context, 5);
    triangleWidth = DensityUtils.dip2px(context, 12);
    triangleHeight = DensityUtils.dip2px(context, 8);
    offset = DensityUtils.dip2px(context, 8);

    if (attrs == null) return;
    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.bubbleView);
    backgroundColor = typedArray.getColor(R.styleable.bubbleView_bgColor, backgroundColor);
    borderColor = typedArray.getColor(R.styleable.bubbleView_borderColor, borderColor);
    offset = (int) typedArray.getDimension(R.styleable.bubbleView_offset, offset);
    borderWidth = (int) typedArray.getDimension(R.styleable.bubbleView_borderWidth, borderWidth);
    radius = (int) typedArray.getDimension(R.styleable.bubbleView_radius, radius);
    orientation = typedArray.getInt(R.styleable.bubbleView_orientation, orientation);
    triangleWidth = (int) typedArray.getDimension(R.styleable.bubbleView_triangleWidth, triangleWidth);
    triangleHeight = (int) typedArray.getDimension(R.styleable.bubbleView_triangleHeight, triangleHeight);
    shadowRadius = (int) typedArray.getDimension(R.styleable.bubbleView_shadowRadius, 0);
    shadowColor = typedArray.getColor(R.styleable.bubbleView_shadowColor, 0xff8D8D8D);
    clipToRadius = typedArray.getBoolean(R.styleable.bubbleView_clipToRadius, clipToRadius);
    centerArrow = typedArray.getBoolean(R.styleable.bubbleView_centerArrow, centerArrow);
    typedArray.recycle();
}
 
开发者ID:leochuan,项目名称:BubbleView,代码行数:26,代码来源:BubbleLayout.java

示例2: 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;
}
 
开发者ID:rjaros87,项目名称:pm-home-station,代码行数:18,代码来源:ChartFragment.java

示例3: 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 == ORIENTATION_HORIZONTAL) {
		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, 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();
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:30,代码来源:ValueBar.java

示例4: Builder

public Builder(ImageLoader loader) {
    this.loader = loader;

    if (FileUtils.isSdCardAvailable())
        filePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Camera";
    else
        filePath = Environment.getRootDirectory().getAbsolutePath() + "/Camera";

    titleBgColor =  Color.BLACK;
    titleColor = Color.WHITE;

    btnBgColor = Color.TRANSPARENT;
    btnTextColor = Color.WHITE;

    FileUtils.createDir(filePath);
}
 
开发者ID:wp521,项目名称:MyFire,代码行数:16,代码来源:ImgSelConfig.java

示例5: onBindViewHolder

@Override
public void onBindViewHolder(final DevicesAdapter.Holder holder, int position) {
  Device device = devices.get(position);

  holder.image.setImageBitmap(Device.getBitmapImage(device.getImage(), holder.image.getContext().getResources()));

  int tintColor = device.isConnected() ? Color.BLACK : Color.WHITE;
  holder.toolbar.setTitle(device.getName());
  holder.toolbar.setTitleTextColor(tintColor);

  holder.toolbar.setSubtitle(device.getAddress());
  holder.toolbar.setSubtitleTextColor(tintColor);

  holder.toolbar.setBackgroundColor(device.isConnected() ? green : red);

  Drawable moreIcon = ContextCompat.getDrawable(holder.toolbar.getContext(), R.drawable.ic_more);
  DrawableCompat.setTint(moreIcon, tintColor);
  holder.toolbar.setOverflowIcon(moreIcon);

  holder.viewStatus.setEnabled(device.isConnected());
  holder.fabAlert.setImageResource(device.isAlerted() ? R.drawable.ic_volume_off : R.drawable.ic_volume_up);
  holder.textStatus.setText(device.isConnected() ? connected : disconnected);
}
 
开发者ID:drfonfon,项目名称:ITagAntiLost,代码行数:23,代码来源:DevicesAdapter.java

示例6: getTextColor

@Override
public int getTextColor(LogcatLine.Priority priority, String tag) {
    switch (priority) {
        case VERBOSE: {
            return Color.BLACK;
        }
        case DEBUG: {
            return Color.BLUE;
        }
        case INFO: {
            return Color.GREEN;
        }
        case WARNING: {
            return Color.YELLOW;
        }
        case ERROR:
        case FATAL:
        case ASSERT: {
            return Color.RED;
        }
        default: {
            return Color.WHITE;
        }
    }
}
 
开发者ID:Manabu-GT,项目名称:DebugOverlay-Android,代码行数:25,代码来源:LogcatLineColorScheme.java

示例7: onViewCreated

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mSearchView = (FloatingSearchView) view.findViewById(R.id.floating_search_view);
    mHeaderView = (TextView)view.findViewById(R.id.header_view);

    mSearchResultsList = (RecyclerView) view.findViewById(R.id.search_results_list);

    mDimSearchViewBackground = view.findViewById(R.id.dim_background);
    mDimDrawable = new ColorDrawable(Color.BLACK);
    mDimDrawable.setAlpha(0);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        mDimSearchViewBackground.setBackground(mDimDrawable);
    }else {
        mDimSearchViewBackground.setBackgroundDrawable(mDimDrawable);
    }
    smar_group_id = checkSmarGroup();
    isFocus = false;
    setupFloatingSearch();
    setupResultsList();
    setupDrawer();
    Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/league.ttf");
    mHeaderView.setTypeface(font);
}
 
开发者ID:interritus1996,项目名称:memento-app,代码行数:24,代码来源:SlidingSearchViewExampleFragment.java

示例8: navigationBarColor

@CheckResult
@ColorInt
public static int navigationBarColor(@NonNull Context context, @Nullable String key) {
    if (context instanceof ATENavigationBarCustomizer) {
        int color = ((ATENavigationBarCustomizer) context).getNavigationBarColor();
        if (color != ATE.USE_DEFAULT) return color;
    } else if (!coloredNavigationBar(context, key)) {
        return Color.BLACK;
    }
    return prefs(context, key).getInt(KEY_NAVIGATION_BAR_COLOR, primaryColor(context, key));
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:11,代码来源:Config.java

示例9: init

private void init(Context context, AttributeSet attrs) {
    if ( null == attrs ) {
        return;
    }

    TypedArray attributeArray = context.obtainStyledAttributes( attrs, R.styleable.TintVtDrTextView);
    Drawable[] drawables = new Drawable[4];
    int[] styleableIds = { R.styleable.TintVtDrTextView_vectorLeft, R.styleable.TintVtDrTextView_vectorTop,
            R.styleable.TintVtDrTextView_vectorRight, R.styleable.TintVtDrTextView_vectorBottom} ;

    int colorId = attributeArray.getResourceId(R.styleable.TintVtDrTextView_vectorTint, -1);
    int tintColor = Color.BLACK;
    if ( -1 != colorId ) {
        tintColor = context.getResources().getColor( colorId );
    }


    for ( int i = 0; i < drawables.length ;i++ ) {
        int rscId = attributeArray.getResourceId(styleableIds[i], -1);
        if ( -1 != rscId ){
            drawables[i] = AppCompatResources.getDrawable(context, rscId) ;

            if ( -1 != tintColor ) {
                DrawableCompat.setTint( drawables[i], tintColor);
            }
        }
    }

    // left, top, right, bottom
    setCompoundDrawablesWithIntrinsicBounds(drawables[0], drawables[1], drawables[2], drawables[3]);
    attributeArray.recycle();
}
 
开发者ID:mithrilcoin-io,项目名称:EosCommander,代码行数:32,代码来源:TintVtDrTextView.java

示例10: init

private void init() {
        ColorMatrix cm = new ColorMatrix();
        cm.setSaturation(0);
        mPaint = new Paint();
//        ColorFilter filter = new PorterDuffColorFilter(SettingsManager.get().getState().isDarkTheme() ?
//                // material design: disabled text color is white with 50% opacity
//                ColorUtils.setAlphaComponent(Color.WHITE, 128) :
//                // material design: disabled text color is black with 38% opacity
//                ColorUtils.setAlphaComponent(Color.BLACK, 97), PorterDuff.Mode.SRC_ATOP);
//        ColorFilter filter = new PorterDuffColorFilter(SettingsManager.get().getState().isDarkTheme() ? Color.GRAY : Color.LTGRAY, PorterDuff.Mode.SRC_ATOP);
        ColorFilter filter = new PorterDuffColorFilter(SettingsManager.get().getState().isDarkTheme() ? Color.WHITE : Color.BLACK, PorterDuff.Mode.SRC_ATOP);
        mPaint.setColorFilter(filter);
        mPaint.setAlpha(SettingsManager.get().getState().isDarkTheme() ? 128 : 97);
//        mPaint.setColorFilter(new ColorMatrixColorFilter(cm));
    }
 
开发者ID:MFlisar,项目名称:RecyclerViewPreferences,代码行数:15,代码来源:SettingsRootView.java

示例11: Builder

public Builder(Context context, String text) {
    this.context = context;
    this.text = text;

    shape = GradientDrawable.RECTANGLE;
    backCol = Color.WHITE;
    borderCol = Color.BLACK;
    textCol = Color.BLACK;
    imageRes = 0;
}
 
开发者ID:shivam301296,项目名称:Android-CustomToast,代码行数:10,代码来源:CT.java

示例12: onSizeChanged

/**
 * 计算每个按钮的位置和尺寸
 * Calculates the position and size of each button
 *
 * @param x
 * @param y
 * @param hSize
 * @param parentLineWidth
 * @param cellsMode
 * @param bmpResId
 * @param context
 */
protected void onSizeChanged(int x, int y, int hSize, int parentLineWidth, boolean cellsMode, int bmpResId, Context context) {
    heightSize = hSize;
    widthSize = heightSize ;
    left = x - widthSize / 2;
    right = x + widthSize / 2;
    top = y - heightSize / 2;
    bottom = y + heightSize / 2;

    if (cellsMode) {
        lineWidth = parentLineWidth;
    } else {
        lineWidth = parentLineWidth ;
    }

    if (bmpResId > 0) {
        Bitmap original = BitmapFactory.decodeResource(context.getResources(), bmpResId);

        if (original != null) {
            Matrix matrix = new Matrix();
            float scaleHeight = mThumbSize * 1.0f / original.getHeight();
            float scaleWidth = scaleHeight;
            matrix.postScale(scaleWidth, scaleHeight);
            bmp = Bitmap.createBitmap(original, 0, 0, original.getWidth(), original.getHeight(), matrix, true);
        }

    } else {
        defaultPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        int radius = (int) (widthSize * DEFAULT_RADIUS);
        int barShadowRadius = (int) (radius * 0.95f);
        int mShadowCenterX = widthSize/2;
        int mShadowCenterY = heightSize/2;
        shadowGradient = new RadialGradient(mShadowCenterX, mShadowCenterY, barShadowRadius, Color.BLACK, Color.TRANSPARENT, Shader.TileMode.CLAMP);
    }
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:46,代码来源:RangeSeekBar.java

示例13: resetDefaultBackgroundAndTextColor

/**
 * 重置背景和文字颜色
 */
public void resetDefaultBackgroundAndTextColor() {
    defaultTextColor = Color.WHITE;
    defaultBackgroundColor = new ColorDrawable(Color.BLACK);
    defaultBackgroundColor.setAlpha(200);
    defaultBackgroundResid = null;
}
 
开发者ID:jeasinlee,项目名称:AndroidBasicLibs,代码行数:9,代码来源:DrawerToast.java

示例14: init

private void init(Context context, AttributeSet attrs) {
    orientation = LEFT;
    radius = DensityUtils.dip2px(context, 5);
    triangleWidth = DensityUtils.dip2px(context, 12);
    triangleHeight = DensityUtils.dip2px(context, 8);
    offset = DensityUtils.dip2px(context, 8);
    borderColor = Color.BLACK;

    if (attrs == null) return;
    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.bubbleView);
    offset = (int) typedArray.getDimension(R.styleable.bubbleView_offset, offset);
    radius = (int) typedArray.getDimension(R.styleable.bubbleView_radius, radius);
    orientation = typedArray.getInt(R.styleable.bubbleView_orientation, orientation);
    triangleWidth = (int) typedArray.getDimension(R.styleable.bubbleView_triangleWidth, triangleWidth);
    triangleHeight = (int) typedArray.getDimension(R.styleable.bubbleView_triangleHeight, triangleHeight);
    borderColor = typedArray.getColor(R.styleable.bubbleView_borderColor, borderColor);
    borderWidth = typedArray.getDimension(R.styleable.bubbleView_borderWidth, 0);
    centerArrow = typedArray.getBoolean(R.styleable.bubbleView_centerArrow, centerArrow);
    shadowRadius = (int) typedArray.getDimension(R.styleable.bubbleView_shadowRadius, 0);
    shadowColor = typedArray.getColor(R.styleable.bubbleView_shadowColor, 0xff8D8D8D);
    if (borderWidth != 0) {
        borderWidth = borderWidth / getResources().getDisplayMetrics().density;
    }
    typedArray.recycle();

    preSetUp = false;
    setImageDrawable(bubbleDrawable);

    if (shadowRadius != 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        setPadding(getPaddingLeft() + shadowRadius, getPaddingTop() + shadowRadius,
                getPaddingRight() + shadowRadius, getPaddingBottom() + shadowRadius);
    }
}
 
开发者ID:leochuan,项目名称:BubbleView,代码行数:34,代码来源:BubbleImageView.java

示例15: setStatusBarColor

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setStatusBarColor(int color) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        if (color == Color.BLACK
                && window.getNavigationBarColor() == Color.BLACK) {
            window.clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        } else {
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        }
        window.setStatusBarColor(color);
    }
}
 
开发者ID:kamisakihideyoshi,项目名称:TaipeiTechRefined,代码行数:13,代码来源:CourseDetailActivity.java


注:本文中的android.graphics.Color.BLACK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。