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


Java Color.parseColor方法代码示例

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


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

示例1: open

import android.graphics.Color; //导入方法依赖的package包/类
void open()
{
    ColorDrawable[] color = {new ColorDrawable(Color.parseColor("#00ffffff")), new ColorDrawable(Color.parseColor("#CC000000"))};
    TransitionDrawable trans = new TransitionDrawable(color);
    //This will work also on old devices. The latest API says you have to use setBackground instead.
    rel.setBackgroundDrawable(trans);
    trans.startTransition(100);


    //rel.setBackgroundColor(Color.parseColor("#CC000000"));
    web.setVisibility(View.VISIBLE);
    fb.setVisibility(View.VISIBLE);
    email.setVisibility(View.VISIBLE);
    webtxt.setVisibility(View.VISIBLE);
    fbtxt.setVisibility(View.VISIBLE);
    emailtxt.setVisibility(View.VISIBLE);

}
 
开发者ID:SkylineLabs,项目名称:FindX,代码行数:19,代码来源:AboutDevelopers.java

示例2: SpotlightConfig

import android.graphics.Color; //导入方法依赖的package包/类
public SpotlightConfig() {
    this.maskColor = 0x70000000;
    this.introAnimationDuration = 400;
    this.isRevealAnimationEnabled = true;
    this.fadingTextDuration = 400;
    this.padding = 20;
    this.dismissOnTouch = true;
    this.dismissOnBackpress=true;
    this.isPerformClick = true;
    this.headingTvSize = 24;
    this.headingTvSizeDimenUnit = -1;
    this.headingTvColor = Color.parseColor("#eb273f");
    this.headingTvText = "Hello";
    this.subHeadingTvSize = 24;
    this.subHeadingTvSizeDimenUnit = -1;
    this.subHeadingTvColor = Color.parseColor("#ffffff");
    this.subHeadingTvText = "Hello";
    this.lineAnimationDuration = 300;
    this.lineStroke = Utils.dpToPx(4);
    this.lineAndArcColor = Color.parseColor("#eb273f");
    this.showTargetArc = true;
}
 
开发者ID:HueToYou,项目名称:ChatExchange-old,代码行数:23,代码来源:SpotlightConfig.java

示例3: foreground

import android.graphics.Color; //导入方法依赖的package包/类
/**
 * ForegroundColorSpan
 */
private void foreground() {
    SpannableString string = new SpannableString("设置文字的前景色为淡蓝色");
    ForegroundColorSpan colorSpan = new ForegroundColorSpan(Color.parseColor("#0099EE"));
    string.setSpan(colorSpan, 9, string.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
    fgtext.setText(string);
}
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:10,代码来源:SpannableStringActivity.java

示例4: linearShader

import android.graphics.Color; //导入方法依赖的package包/类
@ProtoMethod(description = "Create a linear shader", example = "")
@ProtoMethodParam(params = {"x1", "y1", "x2", "y2", "colorHex1", "colorHex2", "tileMode"})
public Shader linearShader(float x1, float y1, float x2, float y2, String c1, String c2) {
    Shader.TileMode mode = Shader.TileMode.REPEAT;

    Shader shader = new LinearGradient(x1, y1, x2, y2, Color.parseColor(c1), Color.parseColor(c2), mode);
    return shader;
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:9,代码来源:PCanvas.java

示例5: reset

import android.graphics.Color; //导入方法依赖的package包/类
public static void reset() {
    Toasty.DEFAULT_TEXT_COLOR = Color.parseColor("#FFFFFF");
    Toasty.ERROR_COLOR = Color.parseColor("#D50000");
    Toasty.INFO_COLOR = Color.parseColor("#3F51B5");
    Toasty.SUCCESS_COLOR = Color.parseColor("#388E3C");
    Toasty.WARNING_COLOR = Color.parseColor("#FFA900");
    Toasty.currentTypeface = LOADED_TOAST_TYPEFACE;
    Toasty.textSize = 16;
    Toasty.tintIcon = true;
}
 
开发者ID:LonelyMushroom,项目名称:aarLibrary,代码行数:11,代码来源:Toasty.java

示例6: onTouchEvent

import android.graphics.Color; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent ev) {
    switch (ev.getAction()) {
        case MotionEvent.ACTION_DOWN:
            if (ev.getX() > mStartX && ev.getX() < mIvBack.getX() - 10) {
                mIsTouchColor = true;
            }
            break;
        case MotionEvent.ACTION_MOVE:
            if (mIsTouchColor && ev.getX() > mStartX && ev.getX() < mIvBack.getX() - 10) {
                int i = (int) ((ev.getX() - mStartX) / mLength);
                mCurrentColor = Color.parseColor(colors[i]);
                mCurrentX = (int) ev.getX();
                invalidate();
            }
            break;
        case MotionEvent.ACTION_UP:
            if (mIsTouchColor) {
                int upX = (int) ev.getX();
                if (upX < mStartX) {
                    upX = mStartX;
                } else if (upX > mIvBack.getX() - 10) {
                    upX = (int) (mIvBack.getX() - 10);
                }
                doXAnim(mStartX + ((upX - mStartX) / mLength) * mLength + mLength / 2);
            }
            break;
    }
    return true;
}
 
开发者ID:liuke2016,项目名称:filepicker,代码行数:31,代码来源:ImageEditLayout.java

示例7: getColorFromAttrs

import android.graphics.Color; //导入方法依赖的package包/类
public static int getColorFromAttrs(int resId, Context context, String defaultColor) {
    TypedValue a = new TypedValue();
    context.getTheme().resolveAttribute(resId, a, true);
    if (a.type >= TypedValue.TYPE_FIRST_COLOR_INT && a.type <= TypedValue.TYPE_LAST_COLOR_INT) {
        return a.data;
    } else {
        return Color.parseColor(defaultColor);
    }
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:10,代码来源:CurrentTheme.java

示例8: parseColor

import android.graphics.Color; //导入方法依赖的package包/类
public static int parseColor(String colorStr, String defaultColor) {
    try {
        return Color.parseColor(colorStr);
    } catch (Exception e) {
        return Color.parseColor(defaultColor);
    }
}
 
开发者ID:alibaba,项目名称:Tangram-Android,代码行数:8,代码来源:SingleImageView.java

示例9: setButton

import android.graphics.Color; //导入方法依赖的package包/类
static void setButton(@ColorInt int bgColor, @ColorInt int color, Button button, boolean colored) {
    if (!colored) {
        if (bgColor!=-1)
            color = bgColor;
        else
            color = Color.parseColor("#ffffff");
    }

    int selectedColor = isColorLight(color) ?
            ColorUtils.blendARGB(color, Color.parseColor("#000000"), 0.15f) :
            ColorUtils.blendARGB(color, Color.parseColor("#FFFFFF"), 0.20f);

    GradientDrawable drawable = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP,
            new int[]{selectedColor, selectedColor});
    GradientDrawable drawable2 = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP,
            new int[]{color, color});

    drawable.setCornerRadius(dpToPx(2));
    drawable2.setCornerRadius(dpToPx(2));

    StateListDrawable button1bg = new StateListDrawable();
    button1bg.addState(new int[] {android.R.attr.state_pressed}, drawable);
    button1bg.addState(new int[] {}, drawable2);
    button1bg.setExitFadeDuration(250);

    button.setBackgroundDrawable(button1bg);
}
 
开发者ID:marcoscgdev,项目名称:DialogSheet,代码行数:28,代码来源:Utils.java

示例10: createButtonBackgroundDrawable

import android.graphics.Color; //导入方法依赖的package包/类
static Drawable createButtonBackgroundDrawable(@NonNull Context context, int fillColor) {
    int buttonCornerRadius = dpToPixels(context, 2);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        TypedValue v = new TypedValue();
        boolean hasAttribute = context.getTheme().resolveAttribute(R.attr.colorControlHighlight, v, true);
        int rippleColor = hasAttribute ? v.data : Color.parseColor("#88CCCCCC");
        return createButtonBackgroundDrawableLollipop(fillColor, rippleColor, buttonCornerRadius);
    }
    return createButtonBackgroundDrawableBase(fillColor, buttonCornerRadius);
}
 
开发者ID:myinnos,项目名称:ImageSaveandShare,代码行数:11,代码来源:UtilsLibrary.java

示例11: parseColor

import android.graphics.Color; //导入方法依赖的package包/类
public static int parseColor(String colorString, int defaultColor) {
    try {
        Integer integer = colorCache.get(colorString);
        if (integer != null) {
            return integer.intValue();
        } else {
            integer = Color.parseColor(colorString);
            colorCache.put(colorString, integer);
            return integer.intValue();
        }
    } catch (Exception e) {
        return defaultColor;
    }
}
 
开发者ID:alibaba,项目名称:Tangram-Android,代码行数:15,代码来源:Style.java

示例12: randomColor

import android.graphics.Color; //导入方法依赖的package包/类
private int randomColor() {
    mBuilder.delete(0, mBuilder.length()); //使用之前首先清空内容

    String haxString;
    for (int i = 0; i < 3; i++) {
        haxString = Integer.toHexString(mRandom.nextInt(0xFF));
        if (haxString.length() == 1) {
            haxString = "0" + haxString;
        }

        mBuilder.append(haxString);
    }

    return Color.parseColor("#" + mBuilder.toString());
}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:16,代码来源:CodeUtils.java

示例13: init

import android.graphics.Color; //导入方法依赖的package包/类
private void init(Context context) {
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mMaskColor = Color.parseColor("#33FFFFFF");
    mCornerColor = Color.WHITE;
    mCornerLength = QRCodeUtil.dp2px(context, 20);
    mCornerSize = QRCodeUtil.dp2px(context, 3);
    mScanLineSize = QRCodeUtil.dp2px(context, 1);
    mScanLineColor = Color.WHITE;
    mScanLineMargin = 0;
    mIsShowDefaultScanLineDrawable = false;
    mCustomScanLineDrawable = null;
    mScanLineBitmap = null;
    mBorderSize = QRCodeUtil.dp2px(context, 1);
    mBorderColor = Color.WHITE;
    mAnimTime = 1000;
    mRectWidth = QRCodeUtil.dp2px(context, 200);
    mMoveStepDistance = QRCodeUtil.dp2px(context, 2);
    mTipText = null;
    mTipTextSize = QRCodeUtil.sp2px(context, 14);
    mTipTextColor = Color.WHITE;
    mIsTipTextBelowRect = false;
    mTipTextMargin = QRCodeUtil.dp2px(context, 20);
    mIsShowTipTextAsSingleLine = false;
    mTipBackgroundColor = Color.parseColor("#22000000");
    mIsShowTipBackground = false;
    mIsScanLineReverse = false;

    mTipPaint = new TextPaint();
    mTipPaint.setAntiAlias(true);

    mTipBackgroundRadius = QRCodeUtil.dp2px(context, 4);
}
 
开发者ID:yinhaojun,项目名称:ZxingForAndroid,代码行数:34,代码来源:ScanBoxView.java

示例14: getSelectedColor

import android.graphics.Color; //导入方法依赖的package包/类
public
@ColorInt
int getSelectedColor() {
    return selectedColor != -1 ?
            selectedColor :
            belongTabBar == null ?
                    Color.parseColor("#4169E1") :
                    belongTabBar.getDefaultSelectedColor();
}
 
开发者ID:LemonAppCN,项目名称:LemonKit4Android,代码行数:10,代码来源:LKTabBarItem.java

示例15: getInActiveColor

import android.graphics.Color; //导入方法依赖的package包/类
/**
 * @param context to fetch color
 * @return in-active color (or) -1 if no color is specified
 */
protected int getInActiveColor(Context context) {
    if (this.mInActiveColorResource != 0) {
        return ContextCompat.getColor(context, mInActiveColorResource);
    } else if (!TextUtils.isEmpty(mInActiveColorCode)) {
        return Color.parseColor(mInActiveColorCode);
    } else if (this.mInActiveColor != 0) {
        return mInActiveColor;
    } else {
        return -1;
    }
}
 
开发者ID:liu-xiao-dong,项目名称:JD-Test,代码行数:16,代码来源:BottomNavigationItem.java


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