當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。