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


Java TypedArray.hasValue方法代码示例

本文整理汇总了Java中android.content.res.TypedArray.hasValue方法的典型用法代码示例。如果您正苦于以下问题:Java TypedArray.hasValue方法的具体用法?Java TypedArray.hasValue怎么用?Java TypedArray.hasValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.res.TypedArray的用法示例。


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

示例1: onProcessTintAttributes

import android.content.res.TypedArray; //导入方法依赖的package包/类
/**
 */
@Override
@SuppressWarnings("ResourceType")
void onProcessTintAttributes(Context context, TypedArray tintAttributes, int tintColor) {
	super.onProcessTintAttributes(context, tintAttributes, tintColor);
	if (UiConfig.MATERIALIZED) {
		if (tintAttributes.hasValue(R.styleable.Ui_HorizontalScrollView_uiBackgroundTint)) {
			setBackgroundTintList(tintAttributes.getColorStateList(R.styleable.Ui_HorizontalScrollView_uiBackgroundTint));
		}
		if (tintAttributes.hasValue(R.styleable.Ui_HorizontalScrollView_uiBackgroundTintMode)) {
			setBackgroundTintMode(TintManager.parseTintMode(
					tintAttributes.getInt(R.styleable.Ui_HorizontalScrollView_uiBackgroundTintMode, 0),
					PorterDuff.Mode.SRC_IN
			));
		}
	} else {
		if (tintAttributes.hasValue(R.styleable.Ui_HorizontalScrollView_uiBackgroundTint)) {
			mTintInfo.backgroundTintList = tintAttributes.getColorStateList(R.styleable.Ui_HorizontalScrollView_uiBackgroundTint);
		}
		mTintInfo.backgroundTintMode = TintManager.parseTintMode(
				tintAttributes.getInt(R.styleable.Ui_HorizontalScrollView_uiBackgroundTintMode, 0),
				mTintInfo.backgroundTintList != null ? PorterDuff.Mode.SRC_IN : null
		);
	}
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:27,代码来源:HorizontalScrollViewWidget.java

示例2: CircleImageView

import android.content.res.TypedArray; //导入方法依赖的package包/类
public CircleImageView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyle, 0);

    mBorderWidth = a.getDimensionPixelSize(R.styleable.CircleImageView_civ_border_width, DEFAULT_BORDER_WIDTH);
    mBorderColor = a.getColor(R.styleable.CircleImageView_civ_border_color, DEFAULT_BORDER_COLOR);
    mBorderOverlay = a.getBoolean(R.styleable.CircleImageView_civ_border_overlay, DEFAULT_BORDER_OVERLAY);

    // Look for deprecated civ_fill_color if civ_circle_background_color is not set
    if (a.hasValue(R.styleable.CircleImageView_civ_circle_background_color)) {
        mCircleBackgroundColor = a.getColor(R.styleable.CircleImageView_civ_circle_background_color,
                DEFAULT_CIRCLE_BACKGROUND_COLOR);
    } else if (a.hasValue(R.styleable.CircleImageView_civ_fill_color)) {
        mCircleBackgroundColor = a.getColor(R.styleable.CircleImageView_civ_fill_color,
                DEFAULT_CIRCLE_BACKGROUND_COLOR);
    }

    a.recycle();

    init();
}
 
开发者ID:sherlockchou86,项目名称:yphoto,代码行数:23,代码来源:CircleImageView.java

示例3: SocialTextView

import android.content.res.TypedArray; //导入方法依赖的package包/类
public SocialTextView(Context c, AttributeSet attrs, int def) {
    super(c, attrs, def);

    // Set the link movement method by default
    setMovementMethod(AccurateMovementMethod.getInstance());

    // Set XML attributes
    TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.SocialTextView);
    this.flags = a.getInt(R.styleable.SocialTextView_linkModes, -1);
    this.hashtagColor = a.getColor(R.styleable.SocialTextView_hashtagColor, Color.RED);
    this.mentionColor = a.getColor(R.styleable.SocialTextView_mentionColor, Color.RED);
    this.phoneColor = a.getColor(R.styleable.SocialTextView_phoneColor, Color.RED);
    this.emailColor = a.getColor(R.styleable.SocialTextView_emailColor, Color.RED);
    this.urlColor = a.getColor(R.styleable.SocialTextView_urlColor, Color.RED);
    this.selectedColor = a.getColor(R.styleable.SocialTextView_selectedColor, Color.LTGRAY);
    this.underlineEnabled = a.getBoolean(R.styleable.SocialTextView_underlineEnabled, false);
    if (a.hasValue(R.styleable.SocialTextView_android_text)) {
        setLinkText(a.getString(R.styleable.SocialTextView_android_text));
    }
    if (a.hasValue(R.styleable.SocialTextView_android_hint)) {
        setLinkHint(a.getString(R.styleable.SocialTextView_android_hint));
    }
    a.recycle();
}
 
开发者ID:tylersuehr7,项目名称:social-text-view,代码行数:25,代码来源:SocialTextView.java

示例4: SwipeRefreshWithText

import android.content.res.TypedArray; //导入方法依赖的package包/类
public SwipeRefreshWithText(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypedArray a = context.getTheme().obtainStyledAttributes(
            attrs,
            R.styleable.LoadingRetryView,
            0, 0);

    try {
        showText = a.getBoolean(R.styleable.SwipeRefreshWithText_showText, false);
        if (a.hasValue(R.styleable.SwipeRefreshWithText_message)) {
            message = a.getString(R.styleable.SwipeRefreshWithText_message);
        } else {
            message = context.getString(R.string.default_empty_message);
        }
    } finally {
        a.recycle();
    }

    LayoutInflater.from(context).inflate(R.layout.layout_refresh, this);
    ButterKnife.bind(this);

    refresh();
}
 
开发者ID:sztomek,项目名称:cleanarchitecture-unidirectional,代码行数:24,代码来源:SwipeRefreshWithText.java

示例5: loadFromAttributes

import android.content.res.TypedArray; //导入方法依赖的package包/类
public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
    TypedArray a = mView.getContext().obtainStyledAttributes(attrs, R.styleable.SkinBackgroundHelper, defStyleAttr, 0);
    try {
        if (a.hasValue(R.styleable.SkinBackgroundHelper_android_background)) {
            mBackgroundResId = a.getResourceId(
                    R.styleable.SkinBackgroundHelper_android_background, INVALID_ID);
        }
    } finally {
        a.recycle();
    }
    applySkin();
}
 
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:13,代码来源:SkinCompatBackgroundHelper.java

示例6: init

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attributeSet) {

		final TypedArray typedArray = context.obtainStyledAttributes(attributeSet, R.styleable.GradientTextView);

		try {
			int colorArrayResourceId = typedArray.getResourceId(R.styleable.GradientTextView_gt_color_list, 0);
			if (colorArrayResourceId != 0) {
				mColors = getResources().getIntArray(colorArrayResourceId);
			}
			if (typedArray.hasValue(R.styleable.GradientTextView_gt_gradient_direction)) {
				int value = typedArray.getInt(R.styleable.GradientTextView_gt_gradient_direction, 0);
				mDIRECTION = DIRECTION.values()[value];
			}

			if (typedArray.hasValue(R.styleable.GradientTextView_gt_gradient_angle)) {
				mAngle = typedArray.getInt(R.styleable.GradientTextView_gt_gradient_angle, 0);
			}

		} catch (Exception e) {
			if (BuildConfig.DEBUG) {
				Log.e(TAG, "Exception", e);
			}
		} finally {
			typedArray.recycle();
		}


	}
 
开发者ID:dimitrisCBR,项目名称:GradientTextView,代码行数:29,代码来源:GradientTextView.java

示例7: resolveOptionalAttributes

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void resolveOptionalAttributes(TypedArray typedArray) {
    fabDrawable = typedArray.getDrawable(R.styleable.FabSpeedDial_fabDrawable);
    if (fabDrawable == null) {
        fabDrawable = ContextCompat.getDrawable(getContext(), R.drawable.fab_add_clear_selector);
    }

    fabDrawableTint = typedArray.getColorStateList(R.styleable.FabSpeedDial_fabDrawableTint);
    if (fabDrawableTint == null) {
        fabDrawableTint = getColorStateList(getContext(), R.color.fab_drawable_tint);
    }

    if (typedArray.hasValue(R.styleable.FabSpeedDial_fabBackgroundTint)) {
        fabBackgroundTint = typedArray.getColorStateList(R.styleable.FabSpeedDial_fabBackgroundTint);
    }

    miniFabBackgroundTint = typedArray.getColorStateList(R.styleable.FabSpeedDial_miniFabBackgroundTint);
    if (miniFabBackgroundTint == null) {
        miniFabBackgroundTint = getColorStateList(getContext(), R.color.fab_background_tint);
    }

    miniFabDrawableTint = typedArray.getColorStateList(R.styleable.FabSpeedDial_miniFabDrawableTint);
    if (miniFabDrawableTint == null) {
        miniFabDrawableTint = getColorStateList(getContext(), R.color.mini_fab_drawable_tint);
    }

    miniFabTitleBackgroundTint = typedArray.getColorStateList(R.styleable.FabSpeedDial_miniFabTitleBackgroundTint);
    if (miniFabTitleBackgroundTint == null) {
        miniFabTitleBackgroundTint = getColorStateList(getContext(), R.color.mini_fab_title_background_tint);
    }

    miniFabTitlesEnabled = typedArray.getBoolean(R.styleable.FabSpeedDial_miniFabTitlesEnabled, true);


    miniFabTitleTextColor = typedArray.getColor(R.styleable.FabSpeedDial_miniFabTitleTextColor,
            ContextCompat.getColor(getContext(), R.color.title_text_color));

    touchGuardDrawable = typedArray.getDrawable(R.styleable.FabSpeedDial_touchGuardDrawable);

    useTouchGuard = typedArray.getBoolean(R.styleable.FabSpeedDial_touchGuard, true);
}
 
开发者ID:gigabytedevelopers,项目名称:FireFiles,代码行数:41,代码来源:FabSpeedDial.java

示例8: SkinCompatSpinner

import android.content.res.TypedArray; //导入方法依赖的package包/类
public SkinCompatSpinner(Context context, AttributeSet attrs, int defStyleAttr, int mode, Resources.Theme popupTheme) {
    super(context, attrs, defStyleAttr, mode, popupTheme);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Spinner, defStyleAttr, 0);

    if (getPopupContext() != null) {
        if (mode == MODE_THEME) {
            if (Build.VERSION.SDK_INT >= 11) {
                // If we're running on API v11+ we will try and read android:spinnerMode
                TypedArray aa = null;
                try {
                    aa = context.obtainStyledAttributes(attrs, ATTRS_ANDROID_SPINNERMODE,
                            defStyleAttr, 0);
                    if (aa.hasValue(0)) {
                        mode = aa.getInt(0, MODE_DIALOG);
                    }
                } catch (Exception e) {
                    Log.i(TAG, "Could not read android:spinnerMode", e);
                } finally {
                    if (aa != null) {
                        aa.recycle();
                    }
                }
            } else {
                // Else, we use a default mode of dropdown
                mode = MODE_DROPDOWN;
            }
        }

        if (mode == MODE_DROPDOWN) {
            final TypedArray pa = getPopupContext().obtainStyledAttributes(attrs, R.styleable.Spinner, defStyleAttr, 0);
            mPopupBackgroundResId = pa.getResourceId(R.styleable.Spinner_android_popupBackground, INVALID_ID);
            pa.recycle();
        }
    }
    a.recycle();

    mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
    mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
}
 
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:40,代码来源:SkinCompatSpinner.java

示例9: onProcessTintAttributes

import android.content.res.TypedArray; //导入方法依赖的package包/类
/**
 */
@Override
@SuppressWarnings("ResourceType")
void onProcessTintAttributes(Context context, TypedArray tintAttributes, int tintColor) {
	if (UiConfig.MATERIALIZED) {
		if (tintAttributes.hasValue(R.styleable.Ui_Spinner_uiBackgroundTint)) {
			setBackgroundTintList(tintAttributes.getColorStateList(R.styleable.Ui_Spinner_uiBackgroundTint));
		}
		if (tintAttributes.hasValue(R.styleable.Ui_Spinner_uiBackgroundTintMode)) {
			setBackgroundTintMode(TintManager.parseTintMode(
					tintAttributes.getInteger(R.styleable.Ui_Spinner_uiBackgroundTintMode, 0),
					PorterDuff.Mode.SRC_IN
			));
		}
	} else {
		final SpinnerTintInfo tintInfo = (SpinnerTintInfo) mTintInfo;
		tintInfo.backgroundTintList = TintManager.createSpinnerTintColors(getContext(), tintColor);
		if (tintAttributes.hasValue(R.styleable.Ui_Spinner_uiBackgroundTint)) {
			tintInfo.backgroundTintList = tintAttributes.getColorStateList(R.styleable.Ui_Spinner_uiBackgroundTint);
		}
		if (tintAttributes.hasValue(R.styleable.Ui_Spinner_uiColorPopupBackground)) {
			tintInfo.popupBackgroundTint = tintAttributes.getColor(R.styleable.Ui_Spinner_uiColorPopupBackground, 0);
		}
		tintInfo.backgroundTintMode = TintManager.parseTintMode(
				tintAttributes.getInteger(R.styleable.Ui_Spinner_uiBackgroundTintMode, 0),
				PorterDuff.Mode.SRC_IN
		);
	}
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:31,代码来源:SpinnerWidget.java

示例10: handleStyledAttributes

import android.content.res.TypedArray; //导入方法依赖的package包/类
@Override
protected void handleStyledAttributes(TypedArray a) {
	super.handleStyledAttributes(a);

	mListViewExtrasEnabled = a.getBoolean(
			R.styleable.PullToRefresh_ptrListViewExtrasEnabled, true);
	
	if (mListViewExtrasEnabled) {
		final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
				FrameLayout.LayoutParams.MATCH_PARENT,
				FrameLayout.LayoutParams.WRAP_CONTENT,
				Gravity.CENTER_HORIZONTAL);

		// Create Loading Views ready for use later
		FrameLayout frame = new FrameLayout(getContext());
		mHeaderLoadingView = createLoadingLayout(getContext(),
				Mode.PULL_FROM_START, a);
		mHeaderLoadingView.setVisibility(View.GONE);
		frame.addView(mHeaderLoadingView, lp);
		mRefreshableView.addHeaderView(frame, null, false);

		mLvFooterLoadingFrame = new FrameLayout(getContext());
		mFooterLoadingView = createLoadingLayout(getContext(),
				Mode.PULL_FROM_END, a);
		mFooterLoadingView.setVisibility(View.GONE);
		mLvFooterLoadingFrame.addView(mFooterLoadingView, lp);

		/**
		 * If the value for Scrolling While Refreshing hasn't been
		 * explicitly set via XML, enable Scrolling While Refreshing.
		 */
		if (!a.hasValue(R.styleable.PullToRefresh_ptrScrollingWhileRefreshingEnabled)) {
			setScrollingWhileRefreshingEnabled(true);
		}
	}
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:37,代码来源:PullToRefreshSwipeListView.java

示例11: setTextAppearanceForTextColor

import android.content.res.TypedArray; //导入方法依赖的package包/类
public void setTextAppearanceForTextColor(int resId, boolean isForced) {
    boolean isTextColorForced = isForced || mTextColorId == 0;
    TypedArray appearance = mView.getContext().obtainStyledAttributes(resId, R.styleable.TextAppearance);
    if (appearance.hasValue(R.styleable.TextAppearance_android_textColor) && isTextColorForced) {
        setTextColor(appearance.getResourceId(R.styleable.TextAppearance_android_textColor, 0));
    }
    appearance.recycle();
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:9,代码来源:AppCompatTextHelper.java

示例12: getInt

import android.content.res.TypedArray; //导入方法依赖的package包/类
@Override
public int getInt(final TypedArray a, final int index, final int defaultValue) {
    if (a.hasValue(index)) {
        return a.getInt(index, defaultValue);
    }
    final Object value = mStyleAttributes.get(index);
    if (value != null) {
        return (Integer)value;
    }
    final KeyStyle parentStyle = mStyles.get(mParentStyleName);
    return parentStyle.getInt(a, index, defaultValue);
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:13,代码来源:KeyStylesSet.java

示例13: initView

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void initView(Context context, AttributeSet attrs) {
    setPadding(80, 40, 80, 120);
    setGravity(Gravity.CENTER);
    setLayerType(LAYER_TYPE_SOFTWARE, null);

    int imageresource = -1;
    if (attrs != null) {
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ShadowImageView);
        if (a.hasValue(R.styleable.ShadowImageView_shadowSrc)) {
            imageresource = a.getResourceId(R.styleable.ShadowImageView_shadowSrc, -1);
        }
        shadowRound = a.getDimensionPixelSize(R.styleable.ShadowImageView_shadowRound, shadowRound);
        if (a.hasValue(R.styleable.ShadowImageView_shadowColor)) {
            shadowColor = a.getColor(R.styleable.ShadowImageView_shadowColor, Color.parseColor("#8D8D8D"));
        }
    } else {
        float density = context.getResources().getDisplayMetrics().density;
        shadowRound = (int) (shadowRound * density);
        imageresource = -1;
    }

    RoundImageView roundImageView = new RoundImageView(context);
    roundImageView.setScaleType(ImageView.ScaleType.FIT_XY);
    if (imageresource == -1) {
        roundImageView.setImageResource(android.R.color.transparent);
    } else {
        roundImageView.setImageResource(imageresource);
    }

    if (this.shadowColor == Color.parseColor("#8D8D8D")) {
        this.shadowColor = -147483648;
    }

    addView(roundImageView);

    getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            int N = getChildCount();
            for (int i = 0; i < N; i++) {
                View view = getChildAt(i);
                if (i != 0) {
                    removeView(view);
                    getChildCount();
                    continue;
                }
                N = getChildCount();
            }

            ((RoundImageView) getChildAt(0)).setRound(shadowRound);
            mInvalidat = true;
        }
    });
}
 
开发者ID:yingLanNull,项目名称:ShadowImageView,代码行数:55,代码来源:ShadowImageView.java

示例14: initView

import android.content.res.TypedArray; //导入方法依赖的package包/类
private void initView(Context context, AttributeSet attrs) {
    setClipToPadding(false);

    DensityUtil density = new DensityUtil();
    ViewConfiguration configuration = ViewConfiguration.get(context);

    mKernel = new RefreshKernelImpl();
    mScroller = new Scroller(context);
    mVelocityTracker = VelocityTracker.obtain();
    mScreenHeightPixels = context.getResources().getDisplayMetrics().heightPixels;
    mReboundInterpolator = new ViscousFluidInterpolator();
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);

    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SmartRefreshLayout);

    ViewCompat.setNestedScrollingEnabled(this, ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableNestedScrolling, false));
    mDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlDragRate, mDragRate);
    mHeaderMaxDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlHeaderMaxDragRate, mHeaderMaxDragRate);
    mFooterMaxDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlFooterMaxDragRate, mFooterMaxDragRate);
    mHeaderTriggerRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlHeaderTriggerRate, mHeaderTriggerRate);
    mFooterTriggerRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlFooterTriggerRate, mFooterTriggerRate);
    mEnableRefresh = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableRefresh, mEnableRefresh);
    mReboundDuration = ta.getInt(R.styleable.SmartRefreshLayout_srlReboundDuration, mReboundDuration);
    mEnableLoadmore = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableLoadmore, mEnableLoadmore);
    mHeaderHeight = ta.getDimensionPixelOffset(R.styleable.SmartRefreshLayout_srlHeaderHeight, density.dip2px(100));
    mFooterHeight = ta.getDimensionPixelOffset(R.styleable.SmartRefreshLayout_srlFooterHeight, density.dip2px(60));
    mDisableContentWhenRefresh = ta.getBoolean(R.styleable.SmartRefreshLayout_srlDisableContentWhenRefresh, mDisableContentWhenRefresh);
    mDisableContentWhenLoading = ta.getBoolean(R.styleable.SmartRefreshLayout_srlDisableContentWhenLoading, mDisableContentWhenLoading);
    mEnableHeaderTranslationContent = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableHeaderTranslationContent, mEnableHeaderTranslationContent);
    mEnableFooterTranslationContent = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableFooterTranslationContent, mEnableFooterTranslationContent);
    mEnablePreviewInEditMode = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnablePreviewInEditMode, mEnablePreviewInEditMode);
    mEnableAutoLoadmore = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableAutoLoadmore, mEnableAutoLoadmore);
    mEnableOverScrollBounce = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableOverScrollBounce, mEnableOverScrollBounce);
    mEnablePureScrollMode = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnablePureScrollMode, mEnablePureScrollMode);
    mEnableScrollContentWhenLoaded = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableScrollContentWhenLoaded, mEnableScrollContentWhenLoaded);
    mEnableLoadmoreWhenContentNotFull = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableLoadmoreWhenContentNotFull, mEnableLoadmoreWhenContentNotFull);
    mEnableFooterFollowWhenLoadFinished = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableFooterFollowWhenLoadFinished, mEnableFooterFollowWhenLoadFinished);
    mEnableOverScrollDrag = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableOverScrollDrag, mEnableOverScrollDrag);
    mFixedHeaderViewId = ta.getResourceId(R.styleable.SmartRefreshLayout_srlFixedHeaderViewId, View.NO_ID);
    mFixedFooterViewId = ta.getResourceId(R.styleable.SmartRefreshLayout_srlFixedFooterViewId, View.NO_ID);

    mManualLoadmore = ta.hasValue(R.styleable.SmartRefreshLayout_srlEnableLoadmore);
    mManualNestedScrolling = ta.hasValue(R.styleable.SmartRefreshLayout_srlEnableNestedScrolling);
    mHeaderHeightStatus = ta.hasValue(R.styleable.SmartRefreshLayout_srlHeaderHeight) ? DimensionStatus.XmlLayoutUnNotify : mHeaderHeightStatus;
    mFooterHeightStatus = ta.hasValue(R.styleable.SmartRefreshLayout_srlFooterHeight) ? DimensionStatus.XmlLayoutUnNotify : mFooterHeightStatus;

    mHeaderExtendHeight = (int) Math.max((mHeaderHeight * (mHeaderMaxDragRate - 1)), 0);
    mFooterExtendHeight = (int) Math.max((mFooterHeight * (mFooterMaxDragRate - 1)), 0);

    int accentColor = ta.getColor(R.styleable.SmartRefreshLayout_srlAccentColor, 0);
    int primaryColor = ta.getColor(R.styleable.SmartRefreshLayout_srlPrimaryColor, 0);
    if (primaryColor != 0) {
        if (accentColor != 0) {
            mPrimaryColors = new int[]{primaryColor, accentColor};
        } else {
            mPrimaryColors = new int[]{primaryColor};
        }
    }

    ta.recycle();

}
 
开发者ID:penghuanliang,项目名称:Rxjava2.0Demo,代码行数:68,代码来源:SmartRefreshLayout.java

示例15: booleanAttr

import android.content.res.TypedArray; //导入方法依赖的package包/类
private static String booleanAttr(final TypedArray a, final int index, final String name) {
    return a.hasValue(index)
            ? String.format(" %s=%s", name, a.getBoolean(index, false)) : "";
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:5,代码来源:KeyboardBuilder.java


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