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


Java Resources.getColorStateList方法代码示例

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


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

示例1: getColorStateList

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * @see android.content.res.Resources#getColorStateList(int id).
 */
@SuppressWarnings("deprecation")
public static ColorStateList getColorStateList(Resources res, int id) throws NotFoundException {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        return res.getColorStateList(id, null);
    } else {
        return res.getColorStateList(id);
    }
}
 
开发者ID:lizhangqu,项目名称:chromium-net-for-android,代码行数:12,代码来源:ApiCompatibilityUtils.java

示例2: getColorStateList

import android.content.res.Resources; //导入方法依赖的package包/类
@Nullable
public static ColorStateList getColorStateList(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 23) {
        return ResourcesCompatApi23.getColorStateList(res, id, theme);
    }
    return res.getColorStateList(id);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:8,代码来源:ResourcesCompat.java

示例3: getColorStateList

import android.content.res.Resources; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static ColorStateList getColorStateList(@NonNull Resources res, @ColorRes int id, @Nullable Resources.Theme theme) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        return res.getColorStateList(id, theme);
    }
    return res.getColorStateList(id);
}
 
开发者ID:roshakorost,项目名称:Phial,代码行数:8,代码来源:ResourcesCompat.java

示例4: getColorStateListFromResource

import android.content.res.Resources; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.M)
static ColorStateList getColorStateListFromResource(@NonNull Resources resources, @ColorRes int colorStateListResID) {
    return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
            ? resources.getColorStateList(colorStateListResID, null)
            : resources.getColorStateList(colorStateListResID);
}
 
开发者ID:customerly,项目名称:Customerly-Android-SDK,代码行数:8,代码来源:IU_Utils.java

示例5: getColorStateList

import android.content.res.Resources; //导入方法依赖的package包/类
public static ColorStateList getColorStateList(Resources res, int id, Theme theme) throws NotFoundException {
    return res.getColorStateList(id, theme);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:ResourcesCompatApi23.java

示例6: getColorStateList

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * Obtains color state list with the specified <var>resId</var> using the given <var>resources</var>.
 * <p>
 * This utility method will obtain the requested color state list in a way that is appropriate
 * for the current Android version.
 *
 * @param resources The resources that should be used to obtain.
 * @param resId     Resource id of the desired color state list to be obtained.
 * @param theme     Theme that will be used to resolve theme attributes for the requested list on
 *                  {@link Build.VERSION_CODES#M} and above Android versions.
 * @return Instance of the requested color state list or {@code null} if the specified resource
 * id is {@code 0}.
 * @see Resources#getColorStateList(int, Resources.Theme)
 * @see Resources#getColorStateList(int)
 */
@Nullable
@SuppressWarnings({"NewApi", "deprecation"})
public static ColorStateList getColorStateList(@NonNull Resources resources, @ColorRes int resId, @Nullable Resources.Theme theme) throws Resources.NotFoundException {
	if (resId == 0) return null;
	else return ACCESS_MARSHMALLOW ? resources.getColorStateList(resId, theme) : resources.getColorStateList(resId);
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:22,代码来源:ResourceUtils.java


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