本文整理匯總了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);
}