本文整理汇总了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;
}