當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。