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


Java AttrRes类代码示例

本文整理汇总了Java中android.support.annotation.AttrRes的典型用法代码示例。如果您正苦于以下问题:Java AttrRes类的具体用法?Java AttrRes怎么用?Java AttrRes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: SearchableSpinner

import android.support.annotation.AttrRes; //导入依赖的package包/类
public SearchableSpinner(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);
    mContext = context;
    getAttributeSet(attrs, defStyleAttr, defStyleRes);

    final LayoutInflater factory = LayoutInflater.from(context);
    factory.inflate(R.layout.view_searchable_spinner, this, true);

    mSpinnerListContainer = (LinearLayout) factory.inflate(R.layout.view_list, this, false);
    mSpinnerListView = (ListView) mSpinnerListContainer.findViewById(R.id.LstVw_SpinnerListView);
    if (mListItemDivider != null) {
        mSpinnerListView.setDivider(mListItemDivider);
        mSpinnerListView.setDividerHeight(mListDividerSize);
    }
    mEmptyTextView = (TextView) mSpinnerListContainer.findViewById(R.id.TxtVw_EmptyText);
    mSpinnerListView.setEmptyView(mEmptyTextView);
}
 
开发者ID:michaelprimez,项目名称:searchablespinner,代码行数:18,代码来源:SearchableSpinner.java

示例2: setCryptoMessageSingleLine

import android.support.annotation.AttrRes; //导入依赖的package包/类
private void setCryptoMessageSingleLine(@AttrRes int colorAttr,
        @StringRes int topTextRes, @DrawableRes int statusIconRes,
        @DrawableRes Integer statusDotsRes) {
    @ColorInt int color = ThemeUtils.getStyledColor(getActivity(), colorAttr);

    authenticationIcon_1.setImageResource(statusIconRes);
    authenticationIcon_1.setColorFilter(color);
    authenticationText.setText(topTextRes);

    if (statusDotsRes != null) {
        authenticationIcon_3.setImageResource(statusDotsRes);
        authenticationIcon_3.setColorFilter(color);
        authenticationIcon_3.setVisibility(View.VISIBLE);
    } else {
        authenticationIcon_3.setVisibility(View.GONE);
    }

    trustText.setVisibility(View.GONE);
    trustIconFrame.setVisibility(View.GONE);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:21,代码来源:SecurityInfoDialog.java

示例3: getAttributeSet

import android.support.annotation.AttrRes; //导入依赖的package包/类
private void getAttributeSet(@Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
    if (attrs != null) {
        try {
            TypedArray attributes = mContext.getTheme().obtainStyledAttributes(attrs, R.styleable.SearchableSpinner, defStyleAttr, defStyleRes);
            mRevealViewBackgroundColor = attributes.getColor(R.styleable.SearchableSpinner_RevealViewBackgroundColor, Color.WHITE);
            mStartEditTintColor = attributes.getColor(R.styleable.SearchableSpinner_StartSearchTintColor, Color.GRAY);
            mEditViewBackgroundColor = attributes.getColor(R.styleable.SearchableSpinner_SearchViewBackgroundColor, Color.WHITE);
            mEditViewTextColor = attributes.getColor(R.styleable.SearchableSpinner_SearchViewTextColor, Color.BLACK);
            mDoneEditTintColor = attributes.getColor(R.styleable.SearchableSpinner_DoneSearchTintColor, Color.GRAY);
            mBordersSize = attributes.getDimensionPixelSize(R.styleable.SearchableSpinner_BordersSize, 4);
            mExpandSize = attributes.getDimensionPixelSize(R.styleable.SearchableSpinner_SpinnerExpandHeight, 0);
            mShowBorders = attributes.getBoolean(R.styleable.SearchableSpinner_ShowBorders, false);
            mBoarderColor = attributes.getColor(R.styleable.SearchableSpinner_BoarderColor, Color.GRAY);
            mAnimDuration = attributes.getColor(R.styleable.SearchableSpinner_AnimDuration, DefaultAnimationDuration);
            mKeepLastSearch = attributes.getBoolean(R.styleable.SearchableSpinner_KeepLastSearch, false);
            mRevealEmptyText = attributes.getString(R.styleable.SearchableSpinner_RevealEmptyText);
            mSearchHintText = attributes.getString(R.styleable.SearchableSpinner_SearchHintText);
            mNoItemsFoundText = attributes.getString(R.styleable.SearchableSpinner_NoItemsFoundText);
            mListItemDivider = attributes.getDrawable(R.styleable.SearchableSpinner_ItemsDivider);
            mListDividerSize = attributes.getDimensionPixelSize(R.styleable.SearchableSpinner_DividerHeight, 0);
        } catch (UnsupportedOperationException e) {
            Log.e("SearchableSpinner", "getAttributeSet --> " + e.getLocalizedMessage());
        }
    }
}
 
开发者ID:michaelprimez,项目名称:searchablespinner,代码行数:26,代码来源:SearchableSpinner.java

示例4: resolveColorStateList

import android.support.annotation.AttrRes; //导入依赖的package包/类
public static ColorStateList resolveColorStateList(Context context, @AttrRes int attr) {
    TEMP_ARRAY[0] = attr;
    TintTypedArray ta = TintTypedArray.obtainStyledAttributes(context, null, TEMP_ARRAY);
    try {
        return ta.getColorStateList(0);
    } finally {
        ta.recycle();
    }
}
 
开发者ID:fekracomputers,项目名称:IslamicLibraryAndroid,代码行数:10,代码来源:Util.java

示例5: resolveResourceId

import android.support.annotation.AttrRes; //导入依赖的package包/类
public static int resolveResourceId(Context context, @AttrRes int attr, int fallback) {
    TEMP_ARRAY[0] = attr;
    TypedArray ta = context.obtainStyledAttributes(TEMP_ARRAY);
    try {
        return ta.getResourceId(0, fallback);
    } finally {
        ta.recycle();
    }
}
 
开发者ID:fekracomputers,项目名称:IslamicLibraryAndroid,代码行数:10,代码来源:Util.java

示例6: getStyleValuesBoolean

import android.support.annotation.AttrRes; //导入依赖的package包/类
public static boolean getStyleValuesBoolean(Context context, @AttrRes int attrId, int style) {
    TypedArray a = null;

    if (style > 0) {
        int[] AttrSet = {attrId};
        a = context.obtainStyledAttributes(style, AttrSet);
        a.recycle();
    }
    return a.getBoolean(0, false);
}
 
开发者ID:Muddz,项目名称:StyleableToast,代码行数:11,代码来源:Utils.java

示例7: setTransportSecurityMessageSingleLine

import android.support.annotation.AttrRes; //导入依赖的package包/类
private void setTransportSecurityMessageSingleLine(@AttrRes int colorAttr,
        @StringRes int topTextRes, @DrawableRes int statusIconRes) {
    @ColorInt int color = ThemeUtils.getStyledColor(getActivity(), colorAttr);

    transportSecurityIcon_1.setImageResource(statusIconRes);
    transportSecurityIcon_1.setColorFilter(color);
    transportSecurityText.setText(topTextRes);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:9,代码来源:SecurityInfoDialog.java

示例8: getDrawable

import android.support.annotation.AttrRes; //导入依赖的package包/类
/**
 * Returns the drawable, which corresponds to a specific theme attribute, regarding the
 * theme, which is used when using a specific layout.
 *
 * @param layout
 *         The layout as a value of the enum {@link Layout}. The layout may not be null
 * @param resourceId
 *         The resource id of the theme attribute, the drawable should be obtained from, as an
 *         {@link Integer} value. The resource id must correspond to a valid theme attribute
 * @return The color state list, which has been obtained, as an instance of the class {@link
 * ColorStateList}
 */
public Drawable getDrawable(@NonNull final Layout layout, @AttrRes final int resourceId) {
    try {
        return ThemeUtil.getDrawable(context, resourceId);
    } catch (NotFoundException e1) {
        int themeResourceId = getThemeResourceId(layout);

        try {
            return ThemeUtil.getDrawable(context, themeResourceId, resourceId);
        } catch (NotFoundException e) {
            themeResourceId = obtainThemeFromThemeAttributes(layout, themeResourceId);
            return ThemeUtil.getDrawable(context, themeResourceId, resourceId);
        }
    }
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:27,代码来源:ThemeHelper.java

示例9: setDKIMMessageSingleLine

import android.support.annotation.AttrRes; //导入依赖的package包/类
private void setDKIMMessageSingleLine(@AttrRes int colorAttr,
        @StringRes int topTextRes, @DrawableRes int statusIconRes) {
    @ColorInt int color = ThemeUtils.getStyledColor(getActivity(), colorAttr);

    dkimIcon_1.setImageResource(statusIconRes);
    dkimIcon_1.setColorFilter(color);
    dkimText.setText(topTextRes);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:9,代码来源:SecurityInfoDialog.java

示例10: getAttributeColor

import android.support.annotation.AttrRes; //导入依赖的package包/类
@ColorInt
   public static int getAttributeColor(Context context, @AttrRes int attr, int fallback) 
{
       TypedArray a = context.getTheme().obtainStyledAttributes(new int[] {attr});
       try 
	{
           return a.getColor(0, fallback);
       }
	finally 
	{
           a.recycle();
       }
   }
 
开发者ID:MSay2,项目名称:Mire,代码行数:14,代码来源:Preferences.java

示例11: getColorFromAttr

import android.support.annotation.AttrRes; //导入依赖的package包/类
/**
 * Get color attribute from current theme
 *
 * @param context Themed context
 * @param attr The resource id of color attribute
 * @return Result
 */
@ColorInt
static int getColorFromAttr(Context context, @AttrRes int attr) {
	TypedArray array = context.getTheme().obtainStyledAttributes(new int[]{attr});
	int color = array.getColor(0, Color.TRANSPARENT);
	array.recycle();
	return color;
}
 
开发者ID:fython,项目名称:MaterialStepperView,代码行数:15,代码来源:ViewUtils.java

示例12: resolveDrawable

import android.support.annotation.AttrRes; //导入依赖的package包/类
private static Drawable resolveDrawable(Context context,
                                        @AttrRes int attr,
                                        @SuppressWarnings(
                                                "SameParameterValue") Drawable fallback) {
    TypedArray a = context.getTheme().obtainStyledAttributes(new int[]{attr});
    try {
        Drawable d = a.getDrawable(0);
        if (d == null && fallback != null)
            d = fallback;
        return d;
    } finally {
        a.recycle();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:DialogUtils.java

示例13: getColor

import android.support.annotation.AttrRes; //导入依赖的package包/类
static int getColor(Context context, @AttrRes int attr, int defaultColor) {
    TypedArray a = context.getTheme().obtainStyledAttributes(new int[]{attr});
    try {
        return a.getColor(0, defaultColor);
    } finally {
        a.recycle();
    }
}
 
开发者ID:AviranAbady,项目名称:CookieBar2,代码行数:9,代码来源:ThemeResolver.java

示例14: SCCameraView

import android.support.annotation.AttrRes; //导入依赖的package包/类
public SCCameraView(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    if (isInEditMode()){
        cameraView = null;
        return;
    }

    cameraView = BaseCameraView.createCameraView(context);
    cameraView.loadAspectRatios();
    this.addView(cameraView);
}
 
开发者ID:team-supercharge,项目名称:SCCameraView,代码行数:12,代码来源:SCCameraView.java

示例15: getThemeAttrBoolean

import android.support.annotation.AttrRes; //导入依赖的package包/类
public static boolean getThemeAttrBoolean(Context context, @AttrRes int attr) {
    TEMP_ARRAY[0] = attr;
    TypedArray a = context.obtainStyledAttributes(null, TEMP_ARRAY);
    try {
        return a.getBoolean(0, false);
    } finally {
        a.recycle();
    }
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:10,代码来源:ThemeUtils.java


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