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


Java Color.MAGENTA属性代码示例

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


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

示例1: onDroidSpeechFinalResult

@Override
public void onDroidSpeechFinalResult(String finalSpeechResult)
{
    // Setting the final speech result
    this.finalSpeechResult.setText(finalSpeechResult);

    if(droidSpeech.getContinuousSpeechRecognition())
    {
        int[] colorPallets1 = new int[] {Color.RED, Color.GREEN, Color.BLUE, Color.CYAN, Color.MAGENTA};
        int[] colorPallets2 = new int[] {Color.YELLOW, Color.RED, Color.CYAN, Color.BLUE, Color.GREEN};

        // Setting random color pallets to the recognition progress view
        droidSpeech.setRecognitionProgressViewColors(new Random().nextInt(2) == 0 ? colorPallets1 : colorPallets2);
    }
    else
    {
        stop.setVisibility(View.GONE);
        start.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:vikramezhil,项目名称:DroidSpeech,代码行数:20,代码来源:Activity_DroidSpeech.java

示例2: UniverseBuilder

UniverseBuilder() {
    width = 600;
    height = 800;
    maxStars = 100;
    maxStarLifespan = 60;
    spawnInterval = 10;
    colorPalette = new int[]{Color.BLACK, Color.GREEN, Color.YELLOW,
            Color.MAGENTA, Color.CYAN, Color.RED};
}
 
开发者ID:catalinc,项目名称:stars-daydream-android,代码行数:9,代码来源:UniverseBuilder.java

示例3: 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;
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-MediaServer,代码行数:16,代码来源:GameSurfaceView.java

示例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;
    }
}
 
开发者ID:adk96r,项目名称:Eye,代码行数:28,代码来源:PersonInfoView.java

示例5: inflateColorStateList

static ColorStateList inflateColorStateList(Context context, XmlPullParser parser, AttributeSet attrs) throws IOException, XmlPullParserException {
    final int innerDepth = parser.getDepth() + 1;
    int depth;
    int type;

    LinkedList<int[]> stateList = new LinkedList<>();
    LinkedList<Integer> colorList = new LinkedList<>();

    while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
            && ((depth = parser.getDepth()) >= innerDepth || type != XmlPullParser.END_TAG)) {
        if (type != XmlPullParser.START_TAG || depth > innerDepth
                || !parser.getName().equals("item")) {
            continue;
        }

        TypedArray a1 = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.color});
        final int value = a1.getResourceId(0, Color.MAGENTA);
        final int baseColor = value == Color.MAGENTA ? Color.MAGENTA : ThemeUtils.replaceColorById(context, value);
        a1.recycle();
        TypedArray a2 = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.alpha});
        final float alphaMod = a2.getFloat(0, 1.0f);
        a2.recycle();
        colorList.add(alphaMod != 1.0f
                ? ColorUtils.setAlphaComponent(baseColor, Math.round(Color.alpha(baseColor) * alphaMod))
                : baseColor);

        stateList.add(extractStateSet(attrs));
    }

    if (stateList.size() > 0 && stateList.size() == colorList.size()) {
        int[] colors = new int[colorList.size()];
        for (int i = 0; i < colorList.size(); i++) {
            colors[i] = colorList.get(i);
        }
        return new ColorStateList(stateList.toArray(new int[stateList.size()][]), colors);
    }
    return null;
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:38,代码来源:ColorStateListUtils.java

示例6: updateShader

private void updateShader(){
    int[] gradient = new int[]{Color.RED, Color.YELLOW, Color.GREEN,
            Color.CYAN, Color.BLUE, Color.MAGENTA, Color.RED};
    SweepGradient rainbow = new SweepGradient(center.x, center.y, gradient, null);

    paint.setShader(rainbow);
}
 
开发者ID:eltos,项目名称:SimpleDialogFragments,代码行数:7,代码来源:ColorWheelView.java

示例7: getStandardColors

static int[] getStandardColors() {
    return new int[]{
            Color.BLACK,
            Color.GRAY,
            Color.LTGRAY,
            Color.WHITE,
            Color.YELLOW,
            Color.CYAN,
            Color.GREEN,
            Color.MAGENTA,
            Color.RED,
            Color.BLUE
    };
}
 
开发者ID:olgamiller,项目名称:SSTVEncoder2,代码行数:14,代码来源:GridColorPalette.java

示例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;
	}
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:29,代码来源:OGLChartOperator.java

示例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;
	}
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:27,代码来源:XYChartOperator.java


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