本文整理汇总了Java中android.support.v7.widget.TintTypedArray类的典型用法代码示例。如果您正苦于以下问题:Java TintTypedArray类的具体用法?Java TintTypedArray怎么用?Java TintTypedArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TintTypedArray类属于android.support.v7.widget包,在下文中一共展示了TintTypedArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setCollapsedTextAppearance
import android.support.v7.widget.TintTypedArray; //导入依赖的package包/类
public void setCollapsedTextAppearance(int resId) {
TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), resId, R.styleable.QMUITextAppearance);
if (a.hasValue(R.styleable.QMUITextAppearance_android_textColor)) {
mCollapsedTextColor = a.getColorStateList(R.styleable.QMUITextAppearance_android_textColor);
}
if (a.hasValue(R.styleable.QMUITextAppearance_android_textSize)) {
mCollapsedTextSize = a.getDimensionPixelSize(R.styleable.QMUITextAppearance_android_textSize,
(int) mCollapsedTextSize);
}
mCollapsedShadowColor = a.getInt(R.styleable.QMUITextAppearance_android_shadowColor, 0);
mCollapsedShadowDx = a.getFloat(R.styleable.QMUITextAppearance_android_shadowDx, 0);
mCollapsedShadowDy = a.getFloat(R.styleable.QMUITextAppearance_android_shadowDy, 0);
mCollapsedShadowRadius = a.getFloat(R.styleable.QMUITextAppearance_android_shadowRadius, 0);
a.recycle();
if (Build.VERSION.SDK_INT >= 16) {
mCollapsedTypeface = readFontFamilyTypeface(resId);
}
recalculate();
}
示例2: setExpandedTextAppearance
import android.support.v7.widget.TintTypedArray; //导入依赖的package包/类
public void setExpandedTextAppearance(int resId) {
TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), resId, R.styleable.QMUITextAppearance);
if (a.hasValue(R.styleable.QMUITextAppearance_android_textColor)) {
mExpandedTextColor = a.getColorStateList(R.styleable.QMUITextAppearance_android_textColor);
}
if (a.hasValue(R.styleable.QMUITextAppearance_android_textSize)) {
mExpandedTextSize = a.getDimensionPixelSize(R.styleable.QMUITextAppearance_android_textSize,
(int) mExpandedTextSize);
}
mExpandedShadowColor = a.getInt(
R.styleable.QMUITextAppearance_android_shadowColor, 0);
mExpandedShadowDx = a.getFloat(
R.styleable.QMUITextAppearance_android_shadowDx, 0);
mExpandedShadowDy = a.getFloat(
R.styleable.QMUITextAppearance_android_shadowDy, 0);
mExpandedShadowRadius = a.getFloat(
R.styleable.QMUITextAppearance_android_shadowRadius, 0);
a.recycle();
if (Build.VERSION.SDK_INT >= 16) {
mExpandedTypeface = readFontFamilyTypeface(resId);
}
recalculate();
}
示例3: 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;
}
}
});
}
示例4: 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;
}
}
});
}
示例5: MyToolBar
import android.support.v7.widget.TintTypedArray; //导入依赖的package包/类
public MyToolBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initview();
if (attrs != null) {
final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
R.styleable.MyToolBar, defStyleAttr, 0);
showSearchView = a.getBoolean(R.styleable.MyToolBar_showSearchView, false);
left_button_icon = a.getDrawable(R.styleable.MyToolBar_leftButtonIcon);
right_button_icon = a.getDrawable(R.styleable.MyToolBar_rightButtonIcon);
title = a.getString(R.styleable.MyToolBar_myTitle);
a.recycle();
}
isShouw();
setContentInsetsRelative(10, 10);
initListener();
}
示例6: 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();
}
}
示例7: 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));
}
示例8: setCollapsedTextAppearance
import android.support.v7.widget.TintTypedArray; //导入依赖的package包/类
public void setCollapsedTextAppearance(int resId) {
TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), resId,
android.support.v7.appcompat.R.styleable.TextAppearance);
if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
mCollapsedTextColor = a.getColorStateList(
android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
}
if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
mCollapsedTextSize = a.getDimensionPixelSize(
android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,
(int) mCollapsedTextSize);
}
mCollapsedShadowColor = a.getInt(
android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor, 0);
mCollapsedShadowDx = a.getFloat(
android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx, 0);
mCollapsedShadowDy = a.getFloat(
android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy, 0);
mCollapsedShadowRadius = a.getFloat(
android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius, 0);
a.recycle();
if (Build.VERSION.SDK_INT >= 16) {
mCollapsedTypeface = readFontFamilyTypeface(resId);
}
recalculate();
}
示例9: setExpandedTextAppearance
import android.support.v7.widget.TintTypedArray; //导入依赖的package包/类
public void setExpandedTextAppearance(int resId) {
TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), resId,
android.support.v7.appcompat.R.styleable.TextAppearance);
if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
mExpandedTextColor = a.getColorStateList(
android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
}
if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
mExpandedTextSize = a.getDimensionPixelSize(
android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,
(int) mExpandedTextSize);
}
mExpandedShadowColor = a.getInt(
android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor, 0);
mExpandedShadowDx = a.getFloat(
android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx, 0);
mExpandedShadowDy = a.getFloat(
android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy, 0);
mExpandedShadowRadius = a.getFloat(
android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius, 0);
a.recycle();
if (Build.VERSION.SDK_INT >= 16) {
mExpandedTypeface = readFontFamilyTypeface(resId);
}
recalculate();
}
示例10: loadFromAttributes
import android.support.v7.widget.TintTypedArray; //导入依赖的package包/类
public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), attrs,
com.ljz.base.widget.R.styleable.SelectorInjection, defStyleAttr, 0);
Drawable[] drawables = mView.getCompoundDrawables();
try {
int leftColor = a.getColor(com.ljz.base.widget.R.styleable.SelectorInjection_drawableLeftTint, DEFAULT_COLOR);
int topColor = a.getColor(com.ljz.base.widget.R.styleable.SelectorInjection_drawableTopTint, DEFAULT_COLOR);
int rightColor = a.getColor(com.ljz.base.widget.R.styleable.SelectorInjection_drawableRightTint, DEFAULT_COLOR);
int bottomColor = a.getColor(com.ljz.base.widget.R.styleable.SelectorInjection_drawableBottomTint, DEFAULT_COLOR);
int[] colors = {leftColor, topColor, rightColor, bottomColor};
tintDrawable(drawables, colors);
} finally {
a.recycle();
}
}
示例11: 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());
}
}
示例12: KyToolBar
import android.support.v7.widget.TintTypedArray; //导入依赖的package包/类
public KyToolBar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView();
final TintTypedArray a =
TintTypedArray.obtainStyledAttributes(getContext(), attrs, R.styleable.KyToolbar,
defStyleAttr, 0);
final boolean enableKyNavigationIcon =
a.getBoolean(R.styleable.KyToolbar_enableKyNavigationIcon, true);
final boolean enableKySearch = a.getBoolean(R.styleable.KyToolbar_enableKySearch, false);
final Drawable navIcon = a.getDrawable(R.styleable.KyToolbar_KyNavigationIcon);
final Drawable rightButtonIcon = a.getDrawable(R.styleable.KyToolbar_setRightButton);
final String rightText = a.getString(R.styleable.KyToolbar_setRightText);
setNavigationIcon(navIcon);
setRightButtonIcon(rightButtonIcon);
enableKyNavigation(enableKyNavigationIcon);
setRightTextView(rightText);
setEnabledSearch(enableKySearch);
a.recycle();
}
示例13: CNiaoToolBar
import android.support.v7.widget.TintTypedArray; //导入依赖的package包/类
public CNiaoToolBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView();
setContentInsetsRelative(10,10);
if(attrs !=null) {
final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
R.styleable.CNiaoToolBar, defStyleAttr, 0);
final Drawable rightIcon = a.getDrawable(R.styleable.CNiaoToolBar_rightButtonIcon);
if (rightIcon != null) {
setRightButtonIcon(rightIcon);
}
boolean isShowSearchView = a.getBoolean(R.styleable.CNiaoToolBar_isShowSearchView,false);
if(isShowSearchView){
showSearchView();
hideTitleView();
}
CharSequence rightButtonText = a.getText(R.styleable.CNiaoToolBar_rightButtonText);
if(rightButtonText !=null){
setRightButtonText(rightButtonText);
}
a.recycle();
}
}
示例14: 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();
}
示例15: 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();
}