本文整理汇总了Java中android.support.v7.widget.TintTypedArray.getResourceId方法的典型用法代码示例。如果您正苦于以下问题:Java TintTypedArray.getResourceId方法的具体用法?Java TintTypedArray.getResourceId怎么用?Java TintTypedArray.getResourceId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.TintTypedArray
的用法示例。
在下文中一共展示了TintTypedArray.getResourceId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reSetTitleStyle
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
/**
* 重新设置标题的样式
*
* @param context
* @param attrs
* @param defStyleAttr
*/
private void reSetTitleStyle(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs,
R.styleable.Toolbar, defStyleAttr, 0);
final int titleTextAppearance = a.getResourceId(R.styleable.Toolbar_titleTextAppearance, 0);
if (titleTextAppearance != 0) {
setTitleTextAppearance(context, titleTextAppearance);
}
if (mTitleTextColor != 0) {
setTitleTextColor(mTitleTextColor);
}
a.recycle();
post(new Runnable() {
@Override
public void run() {
if (getLayoutParams() instanceof LayoutParams) {
((LayoutParams) getLayoutParams()).gravity = Gravity.CENTER;
}
}
});
}
示例2: reSetSubTitleStyle
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
/**
* 重新设置标题的样式
*
* @param context
* @param attrs
* @param defStyleAttr
*/
private void reSetSubTitleStyle(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs,
R.styleable.Toolbar, defStyleAttr, 0);
final int titleTextAppearance = a.getResourceId(R.styleable.Toolbar_subtitleTextAppearance, 0);
if (titleTextAppearance != 0) {
setSubtitleTextAppearance(context, titleTextAppearance);
}
if (mSubtitleTextColor != 0) {
setTitleTextColor(mSubtitleTextColor);
}
a.recycle();
post(new Runnable() {
@Override
public void run() {
if (getLayoutParams() instanceof LayoutParams) {
((LayoutParams) getLayoutParams()).gravity = Gravity.CENTER;
}
}
});
}
示例3: init
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
private void init(final AttributeSet attrs, final int defStyleAttr) {
final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
R.styleable.IcButtonStyle, defStyleAttr, 0);
try {
final AppCompatDrawableManager drawableManager = AppCompatDrawableManager.get();
Drawable rightIcon = a.getDrawableIfKnown(R.styleable.IcButtonStyle_rightIcon);
int id = a.getResourceId(R.styleable.IcButtonStyle_rightIcon, -1);
if (id != -1) {
rightIcon = drawableManager.getDrawable(getContext(), id);
}
Drawable topIcon = a.getDrawableIfKnown(R.styleable.IcButtonStyle_topIcon);
id = a.getResourceId(R.styleable.IcButtonStyle_topIcon, -1);
if (id != -1) {
topIcon = drawableManager.getDrawable(getContext(), id);
}
setCompoundDrawablesWithIntrinsicBounds(null, topIcon, rightIcon, null);
} finally {
a.recycle();
}
}
示例4: createDummyTextView
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
@SuppressLint("PrivateResource")
private void createDummyTextView(Context context) {
final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), null,
R.styleable.Toolbar, R.attr.toolbarStyle, 0);
int titleTextAppearance =
a.getResourceId(R.styleable.Toolbar_titleTextAppearance, 0);
a.recycle();
dummy = new TextView(context);
dummy.setSingleLine();
dummy.setEllipsize(TextUtils.TruncateAt.END);
TextViewCompat.setTextAppearance(dummy, titleTextAppearance);
collapsedTextSize = dummy.getTextSize();
expendedTextSize = collapsedTextSize * TEXT_SCALE_FACTOR;
dummy.setTextSize(ViewUtils.convertPixelToSp(expendedTextSize));
dummy.setVisibility(INVISIBLE);
addView(dummy, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
示例5: ColorToolBar
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public ColorToolBar(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
int attributeCount = attrs.getAttributeCount();
for (int i = 0; i < attributeCount; i++) {
String attributeName = attrs.getAttributeName(i);
Log.i(TAG, "ColorToolBar: "+attributeName);
}
Log.i(TAG, "ColorToolBar: -----------------------------------------------------------");
TypedValue tv = new TypedValue();
final TintTypedArray typedArray = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
android.support.v7.appcompat.R.styleable.Toolbar, 0, 0);
int indexCount = typedArray.getIndexCount();
int resourceId = typedArray.getResourceId(android.support.v7.appcompat.R.styleable.Toolbar_popupTheme, -1);
Log.i(TAG, "ColorToolBar: "+(resourceId > 0 ? "获取到资源id :"+ resourceId : "未获取到资源id"));
for (int i = 0; i < indexCount; i++) {
typedArray.getValue(i,tv);
Log.i(TAG, "ColorToolBar: "+tv.toString());
}
}
示例6: loadFromAttributes
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), attrs,
TINT_ATTRS, defStyleAttr, 0);
mIndeterminateDrawableResId = a.getResourceId(0, INVALID_ID);
mProgressDrawableResId = a.getResourceId(1, INVALID_ID);
a.recycle();
applySkin();
}
示例7: loadFromAttributes
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), 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();
}
示例8: SkinCompatAutoCompleteTextView
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public SkinCompatAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
TINT_ATTRS, defStyleAttr, 0);
if (a.hasValue(0)) {
mDropDownBackgroundResId = a.getResourceId(0, INVALID_ID);
}
a.recycle();
applyDropDownBackgroundResource();
mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
mTextHelper = new SkinCompatTextHelper(this);
mTextHelper.loadFromAttributes(attrs, defStyleAttr);
}
示例9: SkinCompatMultiAutoCompleteTextView
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public SkinCompatMultiAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
TINT_ATTRS, defStyleAttr, 0);
if (a.hasValue(0)) {
mDropDownBackgroundResId = a.getResourceId(0, INVALID_ID);
}
a.recycle();
applyDropDownBackgroundResource();
mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
mTextHelper = new SkinCompatTextHelper(this);
mTextHelper.loadFromAttributes(attrs, defStyleAttr);
}
示例10: loadFromAttributes
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
final Context context = mView.getContext();
// First read the TextAppearance style id
TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs,
R.styleable.SkinCompatTextHelper, defStyleAttr, 0);
final int ap = a.getResourceId(R.styleable.SkinCompatTextHelper_android_textAppearance, INVALID_ID);
SkinLog.d(TAG, "ap = " + ap);
a.recycle();
if (ap != INVALID_ID) {
a = TintTypedArray.obtainStyledAttributes(context, ap, R.styleable.SkinTextAppearance);
if (a.hasValue(R.styleable.SkinTextAppearance_android_textColor)) {
mTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor, INVALID_ID);
SkinLog.d(TAG, "mTextColorResId = " + mTextColorResId);
}
if (a.hasValue(R.styleable.SkinTextAppearance_android_textColorHint)) {
mTextColorHintResId = a.getResourceId(
R.styleable.SkinTextAppearance_android_textColorHint, INVALID_ID);
SkinLog.d(TAG, "mTextColorHintResId = " + mTextColorHintResId);
}
a.recycle();
}
// Now read the style's values
a = TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.SkinTextAppearance,
defStyleAttr, 0);
if (a.hasValue(R.styleable.SkinTextAppearance_android_textColor)) {
mTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor, INVALID_ID);
SkinLog.d(TAG, "mTextColorResId = " + mTextColorResId);
}
if (a.hasValue(R.styleable.SkinTextAppearance_android_textColorHint)) {
mTextColorHintResId = a.getResourceId(
R.styleable.SkinTextAppearance_android_textColorHint, INVALID_ID);
SkinLog.d(TAG, "mTextColorHintResId = " + mTextColorHintResId);
}
a.recycle();
applySkin();
}
示例11: onSetTextAppearance
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public void onSetTextAppearance(Context context, int resId) {
final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context,
resId, R.styleable.SkinTextAppearance);
if (a.hasValue(R.styleable.SkinTextAppearance_android_textColor)) {
mTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor, INVALID_ID);
SkinLog.d(TAG, "mTextColorResId = " + mTextColorResId);
}
if (a.hasValue(R.styleable.SkinTextAppearance_android_textColorHint)) {
mTextColorHintResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColorHint, INVALID_ID);
SkinLog.d(TAG, "mTextColorHintResId = " + mTextColorHintResId);
}
a.recycle();
applySkin();
}
示例12: loadFromAttributes
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
@Override
void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
super.loadFromAttributes(attrs, defStyleAttr);
TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), attrs,
R.styleable.AppCompatSeekBar, defStyleAttr, 0);
mThumbResId = a.getResourceId(R.styleable.AppCompatSeekBar_android_thumb, INVALID_ID);
// final Drawable drawable = a.getDrawableIfKnown(R.styleable.AppCompatSeekBar_android_thumb);
// if (drawable != null) {
// mView.setThumb(drawable);
// }
// mTickMarkResId = a.getResourceId(R.styleable.AppCompatSeekBar_tickMark, INVALID_ID);
// final Drawable tickMark = a.getDrawable(R.styleable.AppCompatSeekBar_tickMark);
// setTickMark(tickMark);
// if (a.hasValue(R.styleable.AppCompatSeekBar_tickMarkTintMode)) {
// mTickMarkTintMode = DrawableUtils.parseTintMode(a.getInt(
// R.styleable.AppCompatSeekBar_tickMarkTintMode, -1), mTickMarkTintMode);
// mHasTickMarkTintMode = true;
// }
// if (a.hasValue(R.styleable.AppCompatSeekBar_tickMarkTint)) {
// mTickMarkTintList = a.getColorStateList(R.styleable.AppCompatSeekBar_tickMarkTint);
// mHasTickMarkTint = true;
// }
a.recycle();
// applyTickMarkTint();
applySkin();
}
示例13: SkinCompatToolbar
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public SkinCompatToolbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
R.styleable.Toolbar, defStyleAttr, 0);
mNavigationIconResId = a.getResourceId(R.styleable.Toolbar_navigationIcon, INVALID_ID);
int titleAp = a.getResourceId(R.styleable.Toolbar_titleTextAppearance, INVALID_ID);
int subtitleAp = a.getResourceId(R.styleable.Toolbar_subtitleTextAppearance, INVALID_ID);
a.recycle();
if (titleAp != INVALID_ID) {
a = TintTypedArray.obtainStyledAttributes(context, titleAp, R.styleable.SkinTextAppearance);
mTitleTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor, INVALID_ID);
a.recycle();
}
if (subtitleAp != INVALID_ID) {
a = TintTypedArray.obtainStyledAttributes(context, subtitleAp, R.styleable.SkinTextAppearance);
mSubtitleTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor, INVALID_ID);
a.recycle();
}
a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
R.styleable.Toolbar, defStyleAttr, 0);
if (a.hasValue(R.styleable.Toolbar_titleTextColor)) {
mTitleTextColorResId = a.getResourceId(R.styleable.Toolbar_titleTextColor, INVALID_ID);
}
if (a.hasValue(R.styleable.Toolbar_subtitleTextColor)) {
mSubtitleTextColorResId = a.getResourceId(R.styleable.Toolbar_subtitleTextColor, INVALID_ID);
}
a.recycle();
applyTitleTextColor();
applySubtitleTextColor();
applyNavigationIcon();
}
示例14: SkinCompatCheckedTextView
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public SkinCompatCheckedTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
mTextHelper = new SkinCompatTextHelper(this);
mTextHelper.loadFromAttributes(attrs, defStyleAttr);
TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
TINT_ATTRS, defStyleAttr, 0);
mCheckMarkResId = a.getResourceId(0, INVALID_ID);
a.recycle();
applyCheckMark();
}
示例15: loadFromAttributes
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
TintTypedArray a = null;
try {
a = TintTypedArray.obtainStyledAttributes(mView.getContext(), attrs,
R.styleable.SkinCompatImageView, defStyleAttr, 0);
mSrcResId = a.getResourceId(R.styleable.SkinCompatImageView_android_src, -1);
} finally {
if (a != null) {
a.recycle();
}
}
applySkin();
}