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