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