當前位置: 首頁>>代碼示例>>Java>>正文


Java ColorRes類代碼示例

本文整理匯總了Java中android.support.annotation.ColorRes的典型用法代碼示例。如果您正苦於以下問題:Java ColorRes類的具體用法?Java ColorRes怎麽用?Java ColorRes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ColorRes類屬於android.support.annotation包,在下文中一共展示了ColorRes類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: newInstance

import android.support.annotation.ColorRes; //導入依賴的package包/類
public static VerificationFragment newInstance(@StringRes int title,
                                               @StringRes int content,
                                               @ColorRes int color,
                                               int position) {

    VerificationFragment fragmentInfo = new VerificationFragment();

    Bundle bundle = new Bundle(4);
    bundle.putInt("title", title);
    bundle.putInt("content", content);
    bundle.putInt("color", color);
    bundle.putInt("order", position);

    fragmentInfo.setArguments(bundle);

    return fragmentInfo;
}
 
開發者ID:LCA311,項目名稱:leoapp-sources,代碼行數:18,代碼來源:VerificationFragment.java

示例2: setStatusColorRes

import android.support.annotation.ColorRes; //導入依賴的package包/類
@Override
public void setStatusColorRes(@ColorRes int colorRes) {
    Activity activity = mActivityRef.get();
    if (activity != null) {
        int color = ContextCompat.getColor(activity, colorRes);
        setStatusColor(color);
    }
}
 
開發者ID:ls1110924,項目名稱:ImmerseMode,代碼行數:9,代碼來源:NormalImmerseMode.java

示例3: setMsgColor

import android.support.annotation.ColorRes; //導入依賴的package包/類
@Override
public BuildBean setMsgColor(@ColorRes int colorRes) {
    if (colorRes > 0) {
        this.msgTxtColor = colorRes;
    }
    return this;
}
 
開發者ID:devzwy,項目名稱:KUtils,代碼行數:8,代碼來源:BuildBean.java

示例4: setNavigationColorRes

import android.support.annotation.ColorRes; //導入依賴的package包/類
@Override
public void setNavigationColorRes(@ColorRes int colorRes) {
    Activity activity = mActivityRef.get();
    if (activity != null) {
        int color = ContextCompat.getColor(activity, colorRes);
        setNavigationColor(color);
    }
}
 
開發者ID:ls1110924,項目名稱:ImmerseMode,代碼行數:9,代碼來源:TlSbNNbImmerseMode.java

示例5: getColorValue

import android.support.annotation.ColorRes; //導入依賴的package包/類
public int getColorValue(@ColorRes int color) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        return getColor(color);
    } else {
        return getResources().getColor(color);
    }
}
 
開發者ID:approov,項目名稱:AppAuth-OAuth2-Books-Demo,代碼行數:8,代碼來源:BooksApp.java

示例6: setColors

import android.support.annotation.ColorRes; //導入依賴的package包/類
public void setColors(@ColorRes int... colorResIds) {
    int colorsCount = Math.min(colorResIds.length, mCount);
    int[] colorRes = new int[colorsCount];
    for (int i = 0; i < colorRes.length; i++) {
        colorRes[i] = ContextCompat.getColor(context, colorResIds[i]);
    }
    setColorSchemeColors(colorRes);
}
 
開發者ID:yanyiqun001,項目名稱:goRefresh,代碼行數:9,代碼來源:MulRingProgressBar.java

示例7: setColorSchemeResources

import android.support.annotation.ColorRes; //導入依賴的package包/類
public void setColorSchemeResources(@ColorRes int... colorResIds) {
    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:JackChan1999,項目名稱:boohee_v5.6,代碼行數:9,代碼來源:SwipeRefreshLayout.java

示例8: animateRevealColorFromCoordinates

import android.support.annotation.ColorRes; //導入依賴的package包/類
private Animator animateRevealColorFromCoordinates(ViewGroup viewRoot, @ColorRes int color, int x, int y) {
    float finalRadius = (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight());

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, x, y, 0, finalRadius);
    viewRoot.setBackgroundColor(ContextCompat.getColor(this, color));
    anim.setDuration(getResources().getInteger(R.integer.anim_duration_long));
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.start();
    return anim;
}
 
開發者ID:shenhuanet,項目名稱:AndroidOpen,代碼行數:11,代碼來源:RevealActivity.java

示例9: get

import android.support.annotation.ColorRes; //導入依賴的package包/類
/**
 * Get a {@link ColorRes} from the given color resource ids
 *
 * @param index the index of the randomized {@link ColorRes}
 * @return a {@link ColorRes}
 */
@ColorRes
public int get(@IntRange(from = 0, to = Integer.MAX_VALUE) int index) {
    if (index < 0) {
        index = Math.abs(index);
    }
    return mColorPalette[index % mCount];
}
 
開發者ID:Tenor-Inc,項目名稱:tenor-android-demo-search,代碼行數:14,代碼來源:ColorPalette.java

示例10: SingleOption

import android.support.annotation.ColorRes; //導入依賴的package包/類
public SingleOption(String title, @ColorRes int titleColor, @DrawableRes int icon, @ColorRes int selectedIconColor,
                    @ColorRes int deselectedIconColor, int borderWidth, @ColorRes int borderColor) {
    super(title, titleColor);
    this.icon = icon;
    this.borderWidth = borderWidth;
    this.borderColor = borderColor;
    this.selectedIconColor = selectedIconColor;
    this.deselectedIconColor = deselectedIconColor;
}
 
開發者ID:FranciscoJavierPRamos,項目名稱:Android-FilterView,代碼行數:10,代碼來源:SingleOption.java

示例11: setBtnColor

import android.support.annotation.ColorRes; //導入依賴的package包/類
@Override
public BuildBean setBtnColor(@ColorRes int btn1Color, @ColorRes int btn2Color, @ColorRes int btn3Color) {
    if (btn1Color > 0)
        this.btn1Color = btn1Color;
    if (btn2Color > 0)
        this.btn2Color = btn2Color;
    if (btn3Color > 0)
        this.btn3Color = btn3Color;
    return this;
}
 
開發者ID:devzwy,項目名稱:KUtils,代碼行數:11,代碼來源:BuildBean.java

示例12: setBackgroundColor

import android.support.annotation.ColorRes; //導入依賴的package包/類
/**
 * Update the background color of the mBgCircle image view.
 */
public void setBackgroundColor(@ColorRes int colorRes) {
    if (getBackground() instanceof ShapeDrawable) {
        final Resources res = getResources();
        ((ShapeDrawable) getBackground()).getPaint().setColor(res.getColor(colorRes));
    }
}
 
開發者ID:lanyuanxiaoyao,項目名稱:PicKing,代碼行數:10,代碼來源:GoogleCircleProgressView.java

示例13: getColor

import android.support.annotation.ColorRes; //導入依賴的package包/類
@ColorInt
public static int getColor(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 23) {
        return ResourcesCompatApi23.getColor(res, id, theme);
    }
    return res.getColor(id);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:8,代碼來源:ResourcesCompat.java

示例14: setProgressColorRes

import android.support.annotation.ColorRes; //導入依賴的package包/類
/**
 * Set the Progress bar color from a color resource
 *
 * @param color The color resource
 * @return This Alerter
 */
public Alerter setProgressColorRes(@ColorRes final int color) {
    if (getAlert() != null) {
        getAlert().setProgressColorRes(color);
    }

    return this;
}
 
開發者ID:Tapadoo,項目名稱:Alerter,代碼行數:14,代碼來源:Alerter.java

示例15: setAllPageBackgroundColor

import android.support.annotation.ColorRes; //導入依賴的package包/類
public LoadDataLayout setAllPageBackgroundColor(@ColorRes int colorId) {
    loadingView.setBackgroundColor(getColor(colorId));
    emptyView.setBackgroundColor(getColor(colorId));
    errorView.setBackgroundColor(getColor(colorId));
    noNetworkView.setBackgroundColor(getColor(colorId));
    return this;
}
 
開發者ID:WangGanxin,項目名稱:LoadDataLayout,代碼行數:8,代碼來源:LoadDataLayout.java


注:本文中的android.support.annotation.ColorRes類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。