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


Java Resources.getColor方法代码示例

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


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

示例1: getRowBackgroundColor

import android.content.res.Resources; //导入方法依赖的package包/类
public static int getRowBackgroundColor(ATableView tableView, ATableViewCell cell) {
    Resources res = tableView.getResources();

    // -1 implies no color defined.
    int color = cell.getBackgroundColor();
    if (color == -1) {
        int tableBackgroundColor = tableView.getBackgroundColor();
        if (tableBackgroundColor == -1) {
            color = res.getColor(R.color.atv_plain_background);
            if (tableView.getStyle() == ATableViewStyle.Grouped) {
                color = res.getColor(R.color.atv_cell_grouped_background);
            }
        } else {
            color = tableBackgroundColor;
        }
    }

    return color;
}
 
开发者ID:hh-in-zhuzhou,项目名称:ShangHanLun,代码行数:20,代码来源:DrawableUtils.java

示例2: SimpleMonthView

import android.content.res.Resources; //导入方法依赖的package包/类
public SimpleMonthView(Context context) {
	super(context);
	Resources resources = context.getResources();
	mDayLabelCalendar = Calendar.getInstance();
	mCalendar = Calendar.getInstance();

	mDayOfWeekTypeface = resources.getString(R.string.day_of_week_label_typeface);
	mMonthTitleTypeface = resources.getString(R.string.sans_serif);
	mDayTextColor = resources.getColor(R.color.date_picker_text_normal);
	mTodayNumberColor = resources.getColor(R.color.blue);
	mMonthTitleColor = resources.getColor(R.color.white);
	mMonthTitleBGColor = resources.getColor(R.color.circle_background);

	mStringBuilder = new StringBuilder(50);
	mFormatter = new Formatter(mStringBuilder, Locale.getDefault());

	MINI_DAY_NUMBER_TEXT_SIZE = resources.getDimensionPixelSize(R.dimen.day_number_size);
	MONTH_LABEL_TEXT_SIZE = resources.getDimensionPixelSize(R.dimen.month_label_size);
	MONTH_DAY_LABEL_TEXT_SIZE = resources.getDimensionPixelSize(R.dimen.month_day_label_text_size);
	MONTH_HEADER_SIZE = resources.getDimensionPixelOffset(R.dimen.month_list_item_header_height);
	DAY_SELECTED_CIRCLE_SIZE = resources.getDimensionPixelSize(R.dimen.day_number_select_circle_radius);

	mRowHeight = ((resources.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height) - MONTH_HEADER_SIZE) / 6);

       initView();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:SimpleMonthView.java

示例3: ViewfinderView

import android.content.res.Resources; //导入方法依赖的package包/类
public ViewfinderView(Context context, AttributeSet attrs) {
	super(context, attrs);
	// Initialize these once for performance rather than calling them every
	// time in onDraw().
	density = context.getResources().getDisplayMetrics().density;
	// 将像素转换成dp
	ScreenRate = (int) (20 * density);
	paint = new Paint(Paint.ANTI_ALIAS_FLAG);
	Resources resources = getResources();
	maskColor = resources.getColor(R.color.viewfinder_mask);
	resultColor = resources.getColor(R.color.result_view);

	resultPointColor = resources.getColor(R.color.possible_result_points);
	possibleResultPoints = new ArrayList<ResultPoint>(5);
	lastPossibleResultPoints = null;
}
 
开发者ID:dufangyu1990,项目名称:LeCatApp,代码行数:17,代码来源:ViewfinderView.java

示例4: getPurpleColor

import android.content.res.Resources; //导入方法依赖的package包/类
public static int[] getPurpleColor(Context context) {
    int[] color = new int[14];
    Resources resources = context.getResources();
    if (resources != null) {
        for (int i = 1; i <= 14; i++) {
            color[i - 1] = resources.getColor(ResUtils.getColorId(context, "smart_color_purple" + i));
        }
    }
    return color;
}
 
开发者ID:miaolingzi,项目名称:SmartColorView,代码行数:11,代码来源:ColorUtils.java

示例5: LinePageIndicator

import android.content.res.Resources; //导入方法依赖的package包/类
public LinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode()) return;

    final Resources res = getResources();

    //Load defaults from resources
    final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
    final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);
    final float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
    final float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);
    final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LinePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.LinePageIndicator_centered, defaultCentered);
    mLineWidth = a.getDimension(R.styleable.LinePageIndicator_lineWidth, defaultLineWidth);
    mGapWidth = a.getDimension(R.styleable.LinePageIndicator_gapWidth, defaultGapWidth);
    setStrokeWidth(a.getDimension(R.styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintUnselected.setColor(a.getColor(R.styleable.LinePageIndicator_unselectedColor, defaultUnselectedColor));
    mPaintSelected.setColor(a.getColor(R.styleable.LinePageIndicator_selectedColor, defaultSelectedColor));

    Drawable background = a.getDrawable(R.styleable.LinePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();
}
 
开发者ID:hanhailong,项目名称:GridPagerSnapHelper,代码行数:32,代码来源:LinePageIndicator.java

示例6: UnderlinePageIndicator

import android.content.res.Resources; //导入方法依赖的package包/类
public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode()) return;

    final Resources res = getResources();

    //Load defaults from resources
    final boolean defaultFades = res.getBoolean(R.bool.default_underline_indicator_fades);
    final int defaultFadeDelay = res.getInteger(R.integer.default_underline_indicator_fade_delay);
    final int defaultFadeLength = res.getInteger(R.integer.default_underline_indicator_fade_length);
    final int defaultSelectedColor = res.getColor(R.color.default_underline_indicator_selected_color);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.UnderlinePageIndicator, defStyle, 0);

    setFades(a.getBoolean(R.styleable.UnderlinePageIndicator_fades, defaultFades));
    setSelectedColor(a.getColor(R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor));
    setFadeDelay(a.getInteger(R.styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay));
    setFadeLength(a.getInteger(R.styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength));

    Drawable background = a.getDrawable(R.styleable.UnderlinePageIndicator_android_background);
    if (background != null) {
      setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:UnderlinePageIndicator.java

示例7: ViewfinderView

import android.content.res.Resources; //导入方法依赖的package包/类
public ViewfinderView(Context context, AttributeSet attrs) {
    super(context, attrs);

    // Initialize these once for performance rather than calling them every time in onDraw().
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    Resources resources = getResources();
    maskColor = resources.getColor(R.color.viewfinder_mask);
    resultColor = resources.getColor(R.color.result_view);
    laserColor = resources.getColor(R.color.viewfinder_laser);
    resultPointColor = resources.getColor(R.color.possible_result_points);
    scannerAlpha = 0;
    possibleResultPoints = new ArrayList<>(5);
    lastPossibleResultPoints = null;
}
 
开发者ID:xiong-it,项目名称:ZXingAndroidExt,代码行数:15,代码来源:ViewfinderView.java

示例8: setProgressColorSchemeColorsFromResource

import android.content.res.Resources; //导入方法依赖的package包/类
public void setProgressColorSchemeColorsFromResource(@IdRes int... resources) {
    final Resources res = getResources();
    final int[] colorRes = new int[resources.length];

    for (int i = 0; i < resources.length; i++) {
        colorRes[i] = res.getColor(resources[i]);
    }

    setColorSchemeColors(colorRes);
}
 
开发者ID:scwang90,项目名称:SmartRefreshLayout,代码行数:11,代码来源:WaveSwipeHeader.java

示例9: LinePageIndicator

import android.content.res.Resources; //导入方法依赖的package包/类
public LinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode()) return;

    final Resources res = getResources();

    //Load defaults from resources
    final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
    final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);
    final float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
    final float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);
    final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LinePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.LinePageIndicator_centered, defaultCentered);
    mLineWidth = a.getDimension(R.styleable.LinePageIndicator_lineWidth, defaultLineWidth);
    mGapWidth = a.getDimension(R.styleable.LinePageIndicator_gapWidth, defaultGapWidth);
    setStrokeWidth(a.getDimension(R.styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintUnselected.setColor(a.getColor(R.styleable.LinePageIndicator_unselectedColor, defaultUnselectedColor));
    mPaintSelected.setColor(a.getColor(R.styleable.LinePageIndicator_selectedColor, defaultSelectedColor));

    Drawable background = a.getDrawable(R.styleable.LinePageIndicator_android_background);
    if (background != null) {
      setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:LinePageIndicator.java

示例10: ViewfinderView

import android.content.res.Resources; //导入方法依赖的package包/类
public ViewfinderView(Context context, AttributeSet attrs) {
  super(context, attrs);

  // Initialize these once for performance rather than calling them every time in onDraw().
  paint = new Paint();
  Resources resources = getResources();
  maskColor = resources.getColor(R.color.viewfinder_mask);
  resultColor = resources.getColor(R.color.result_view);
  frameColor = resources.getColor(R.color.viewfinder_frame);
  laserColor = resources.getColor(R.color.viewfinder_laser);
  resultPointColor = resources.getColor(R.color.possible_result_points);
  scannerAlpha = 0;
  possibleResultPoints = new HashSet<ResultPoint>(5);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:ViewfinderView.java

示例11: getColor

import android.content.res.Resources; //导入方法依赖的package包/类
public int getColor(Context context, int colorRes) {
    Resources resources = context.getResources();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        return resources.getColor(colorRes, null);
    }
    return resources.getColor(colorRes);
}
 
开发者ID:sinhaDroid,项目名称:BlogBookApp,代码行数:8,代码来源:InAppActivity.java

示例12: initialize

import android.content.res.Resources; //导入方法依赖的package包/类
public void initialize(Context context, TimePickerController controller, int amOrPm) {
    if (this.mIsInitialized) {
        Log.e(TAG, "AmPmCirclesView may only be initialized once.");
        return;
    }
    Resources res = context.getResources();
    if (controller.isThemeDark()) {
        this.mUnselectedColor = res.getColor(R.color.mdtp_circle_background_dark_theme);
        this.mAmPmTextColor = res.getColor(R.color.mdtp_white);
        this.mSelectedAlpha = 255;
    } else {
        this.mUnselectedColor = res.getColor(R.color.mdtp_white);
        this.mAmPmTextColor = res.getColor(R.color.mdtp_ampm_text_color);
        this.mSelectedAlpha = 255;
    }
    this.mSelectedColor = controller.getAccentColor();
    this.mTouchedColor = Utils.darkenColor(this.mSelectedColor);
    this.mAmPmSelectedTextColor = res.getColor(R.color.mdtp_white);
    this.mPaint.setTypeface(Typeface.create(res.getString(R.string.mdtp_sans_serif), 0));
    this.mPaint.setAntiAlias(true);
    this.mPaint.setTextAlign(Align.CENTER);
    this.mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string
            .mdtp_circle_radius_multiplier));
    this.mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string
            .mdtp_ampm_circle_radius_multiplier));
    String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
    this.mAmText = amPmTexts[0];
    this.mPmText = amPmTexts[1];
    setAmOrPm(amOrPm);
    this.mAmOrPmPressed = -1;
    this.mIsInitialized = true;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:33,代码来源:AmPmCirclesView.java

示例13: setColorSchemeResources

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * Set the color resources used in the progress animation from color resources.
 * The first color will also be the color of the bar that grows in response
 * to a user swipe gesture.
 *
 * @param colorResIds
 */
public void setColorSchemeResources(int... colorResIds) {
    final Resources res = getResources();
    int[] colorRes = new int[colorResIds.length];
    for (int i = 0; i < colorResIds.length; i++) {
        colorRes[i] = res.getColor(colorResIds[i]);
    }
    setColorSchemeColors(colorRes);
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:16,代码来源:LingjuSwipeRefreshLayout.java

示例14: Utils

import android.content.res.Resources; //导入方法依赖的package包/类
public Utils(Context context) {
	Resources r = context.getResources();
	this.positiveColor = r.getColor(R.color.positive_amount);
	this.negativeColor = r.getColor(R.color.negative_amount);
       this.transferColor = r.getColor(R.color.transfer_color);
       this.futureColor = r.getColor(R.color.future_color);
       this.context = context;
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:9,代码来源:Utils.java

示例15: LinePageIndicator

import android.content.res.Resources; //导入方法依赖的package包/类
public LinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    this.mPaintUnselected = new Paint(1);
    this.mPaintSelected = new Paint(1);
    this.mLastMotionX = -1.0f;
    this.mActivePointerId = -1;
    if (!isInEditMode()) {
        Resources res = getResources();
        int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
        int defaultUnselectedColor = res.getColor(R.color
                .default_line_indicator_unselected_color);
        float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
        float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
        float defaultStrokeWidth = res.getDimension(R.dimen
                .default_line_indicator_stroke_width);
        boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LinePageIndicator,
                defStyle, 0);
        this.mCentered = a.getBoolean(1, defaultCentered);
        this.mLineWidth = a.getDimension(5, defaultLineWidth);
        this.mGapWidth = a.getDimension(6, defaultGapWidth);
        setStrokeWidth(a.getDimension(3, defaultStrokeWidth));
        this.mPaintUnselected.setColor(a.getColor(4, defaultUnselectedColor));
        this.mPaintSelected.setColor(a.getColor(2, defaultSelectedColor));
        Drawable background = a.getDrawable(0);
        if (background != null) {
            setBackgroundDrawable(background);
        }
        a.recycle();
        this.mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(ViewConfiguration
                .get(context));
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:34,代码来源:LinePageIndicator.java


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