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


Java ColorUtils.blendARGB方法代码示例

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


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

示例1: setButton

import android.support.v4.graphics.ColorUtils; //导入方法依赖的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

示例2: handleOverflow

import android.support.v4.graphics.ColorUtils; //导入方法依赖的package包/类
private void handleOverflow(){
    //If max images reached
    if(getImageCount() >= getMaxImageCount()){
        if(overflowView == null) {
            overflowView = new TextImageView(getContext());
        }
        removeExtraViews();
        updateLayoutRepresentation(getWidth(), getHeight(), getChildCount(), true);
    }

    //setup overflow view
    if(extraImages > 0){
        overflowView.setText(getResources().getString(R.string.more_images, extraImages));
        int color = ColorUtils.blendARGB(moreTextColor, moreColor, 0.4f);
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            RippleDrawable rippledImage = new RippleDrawable(
                    ColorStateList.valueOf(color), null, null);
            overflowView.setForeground(rippledImage);
        }else{
            int[] attrs = new int[] { android.R.attr.selectableItemBackground /* index 0 */};
            TypedArray ta = getContext().obtainStyledAttributes(attrs);
            Drawable drawableFromTheme = ta.getDrawable(0 /* index */);
            ta.recycle();
            overflowView.setForeground(drawableFromTheme);
        }
        overflowView.setTextColor(moreTextColor).setImageBackgroundColor(moreColor);

        addClickListeners();

        if(overflowView.getParent() != this) {
            addView1(overflowView, lowerRightCorner.getIndex());
        }
    }
}
 
开发者ID:0lumide,项目名称:ImageGridLayout,代码行数:35,代码来源:ImageGridLayout.java

示例3: setBackgroundColor

import android.support.v4.graphics.ColorUtils; //导入方法依赖的package包/类
private void setBackgroundColor(int currentValue) {
    final float coefficient = currentValue / (float) (temperatureView.getMaxValue());
    final int color = ColorUtils.blendARGB(Color.parseColor("#FF9D6E"), Color.parseColor("#6ABFFF"), coefficient);
    rlRoot.setBackgroundColor(color);
}
 
开发者ID:TheMindStudios,项目名称:CircleControlView,代码行数:6,代码来源:TemperatureActivity.java

示例4: blendUpper

import android.support.v4.graphics.ColorUtils; //导入方法依赖的package包/类
public void blendUpper(@ColorInt int color) {
    int avg = ColorUtils.blendARGB(color, getUpper(), RATIO);
    pair = Pair.create(avg, getLower());
}
 
开发者ID:alxgrk,项目名称:BlendedBackground,代码行数:5,代码来源:ColorPair.java

示例5: blendLower

import android.support.v4.graphics.ColorUtils; //导入方法依赖的package包/类
public void blendLower(@ColorInt int color) {
    int avg = ColorUtils.blendARGB(color, getLower(), RATIO);
    pair = Pair.create(getUpper(), avg);
}
 
开发者ID:alxgrk,项目名称:BlendedBackground,代码行数:5,代码来源:ColorPair.java

示例6: setColorRatio

import android.support.v4.graphics.ColorUtils; //导入方法依赖的package包/类
public void setColorRatio(float ratio) {
    mColorRatio = Math.max(0f, Math.min(ratio, 1f));
    mColor = ColorUtils.blendARGB(mColorStart, mColorEnd, mColorRatio);
    invalidateSelf();
}
 
开发者ID:TR4Android,项目名称:AppCompat-Extension-Library,代码行数:6,代码来源:ColorTransitionDrawable.java

示例7: blendColor

import android.support.v4.graphics.ColorUtils; //导入方法依赖的package包/类
/**
 * Returns a blend color of 2 colors
 *
 * @param color1 The preferred color 1
 *
 * @param color2 The preferred color 2
 *
 * @return The blend color of color 1 & color 2
 */
private int blendColor(int color1, int color2) {
    return ColorUtils.blendARGB(color1, color2, 0.8f);
}
 
开发者ID:vikramezhil,项目名称:DroidCalorieCounterView,代码行数:13,代码来源:CalorieCounterView.java


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