本文整理匯總了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;
}
示例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);
}
}
示例3: setMsgColor
import android.support.annotation.ColorRes; //導入依賴的package包/類
@Override
public BuildBean setMsgColor(@ColorRes int colorRes) {
if (colorRes > 0) {
this.msgTxtColor = colorRes;
}
return this;
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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];
}
示例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;
}
示例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;
}
示例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));
}
}
示例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);
}
示例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;
}
示例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;
}