本文整理汇总了Java中android.support.v7.widget.TintTypedArray.getDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java TintTypedArray.getDrawable方法的具体用法?Java TintTypedArray.getDrawable怎么用?Java TintTypedArray.getDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.TintTypedArray
的用法示例。
在下文中一共展示了TintTypedArray.getDrawable方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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();
}
}
示例4: PreferenceDividerDecoration
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public PreferenceDividerDecoration(Context context) {
TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, null,
new int[] {R.attr.dividerHorizontal});
mDivider = a.getDrawable(0);
a.recycle();
mDividerHeight = mDivider.getIntrinsicHeight();
}
示例5: TabItem
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public TabItem(Context context, AttributeSet attrs) {
super(context, attrs);
TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.TabItem);
this.mText = a.getText(R.styleable.TabItem_android_text);
this.mIcon = a.getDrawable(R.styleable.TabItem_android_icon);
this.mCustomLayout = a.getResourceId(R.styleable.TabItem_android_layout, 0);
a.recycle();
}
示例6: TabItem
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public TabItem(Context context, AttributeSet attrs) {
super(context, attrs);
final TintTypedArray a =
TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.TabItem);
text = a.getText(R.styleable.TabItem_android_text);
icon = a.getDrawable(R.styleable.TabItem_android_icon);
customLayout = a.getResourceId(R.styleable.TabItem_android_layout, 0);
a.recycle();
}
示例7: TabItem
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public TabItem(Context context, AttributeSet attrs) {
super(context, attrs);
final TintTypedArray a =
TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.TabItem);
mText = a.getText(R.styleable.TabItem_android_text);
mIcon = a.getDrawable(R.styleable.TabItem_android_icon);
mCustomLayout = a.getResourceId(R.styleable.TabItem_android_layout, 0);
a.recycle();
}
示例8: NumberAddSubView
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public NumberAddSubView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
//把布局和当前类形成整体
View.inflate(context, R.layout.number_add_sub_layout, this);
btn_sub = (ImageView) findViewById(R.id.btn_sub);
btn_add = (ImageView) findViewById(R.id.btn_add);
tv_count = (TextView) findViewById(R.id.tv_count);
getValue();
//设置点击事件
btn_add.setOnClickListener(this);
btn_sub.setOnClickListener(this);
if (attrs != null) {
//取出属性
TintTypedArray tintTypedArray = TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.NumberAddSubView);
int value = tintTypedArray.getInt(R.styleable.NumberAddSubView_value, 0);
if (value > 0) {
setValue(value);
}
int minValue = tintTypedArray.getInt(R.styleable.NumberAddSubView_minValue, 0);
if (value > 0) {
setMinValue(minValue);
}
int maxValue = tintTypedArray.getInt(R.styleable.NumberAddSubView_maxValue, 0);
if (value > 0) {
setMaxValue(maxValue);
}
Drawable addDrawable = tintTypedArray.getDrawable(R.styleable.NumberAddSubView_numberAddBackground);
if (addDrawable != null) {
btn_add.setImageDrawable(addDrawable);
}
Drawable subDrawable = tintTypedArray.getDrawable(R.styleable.NumberAddSubView_numberSubBackground);
if (subDrawable != null) {
btn_sub.setImageDrawable(subDrawable);
}
}
}
示例9: NumberAddSubView
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public NumberAddSubView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mInflater = LayoutInflater.from(context);
initView();
if (attrs != null) {
final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
R.styleable.NumberAddSubView, defStyleAttr, 0);
int val = a.getInt(R.styleable.NumberAddSubView_value, 0);
setValue(val);
int maxVal = a.getInt(R.styleable.NumberAddSubView_maxValue, 0);
if (maxVal != 0)
setMaxValue(maxVal);
int minVal = a.getInt(R.styleable.NumberAddSubView_minValue, 0);
setMinValue(minVal);
Drawable etBackground = a.getDrawable(R.styleable.NumberAddSubView_editBackground);
if (etBackground != null)
setEditTextBackground(etBackground);
Drawable buttonAddBackground = a.getDrawable(R.styleable
.NumberAddSubView_buttonAddBackgroud);
if (buttonAddBackground != null)
setButtonAddBackgroud(buttonAddBackground);
Drawable buttonSubBackground = a.getDrawable(R.styleable
.NumberAddSubView_buttonSubBackgroud);
if (buttonSubBackground != null)
setButtonSubBackgroud(buttonSubBackground);
a.recycle();
}
}
示例10: getThemeUpIndicator
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public Drawable getThemeUpIndicator() {
TintTypedArray a = TintTypedArray.obtainStyledAttributes(getActionBarThemedContext(), null, new int[]{R.attr.homeAsUpIndicator});
Drawable result = a.getDrawable(0);
a.recycle();
return result;
}
示例11: TextInputLayout
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public TextInputLayout(Context context, AttributeSet attrs, int defStyleAttr) {
// Can't call through to super(Context, AttributeSet, int) since it doesn't exist on API 10
super(context, attrs);
ThemeUtils.checkAppCompatTheme(context);
setOrientation(VERTICAL);
setWillNotDraw(false);
setAddStatesFromChildren(true);
mInputFrame = new FrameLayout(context);
mInputFrame.setAddStatesFromChildren(true);
addView(mInputFrame);
mCollapsingTextHelper.setTextSizeInterpolator(AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR);
mCollapsingTextHelper.setPositionInterpolator(new AccelerateInterpolator());
mCollapsingTextHelper.setCollapsedTextGravity(Gravity.TOP | GravityCompat.START);
final TintTypedArray a =
TintTypedArray.obtainStyledAttributes(
context,
attrs,
R.styleable.TextInputLayout,
defStyleAttr,
R.style.Widget_Design_TextInputLayout);
mHintEnabled = a.getBoolean(R.styleable.TextInputLayout_hintEnabled, true);
setHint(a.getText(R.styleable.TextInputLayout_android_hint));
mHintAnimationEnabled = a.getBoolean(R.styleable.TextInputLayout_hintAnimationEnabled, true);
if (a.hasValue(R.styleable.TextInputLayout_android_textColorHint)) {
mDefaultTextColor =
mFocusedTextColor =
a.getColorStateList(R.styleable.TextInputLayout_android_textColorHint);
}
final int hintAppearance = a.getResourceId(R.styleable.TextInputLayout_hintTextAppearance, -1);
if (hintAppearance != -1) {
setHintTextAppearance(a.getResourceId(R.styleable.TextInputLayout_hintTextAppearance, 0));
}
mErrorTextAppearance = a.getResourceId(R.styleable.TextInputLayout_errorTextAppearance, 0);
final boolean errorEnabled = a.getBoolean(R.styleable.TextInputLayout_errorEnabled, false);
final boolean counterEnabled = a.getBoolean(R.styleable.TextInputLayout_counterEnabled, false);
setCounterMaxLength(a.getInt(R.styleable.TextInputLayout_counterMaxLength, INVALID_MAX_LENGTH));
mCounterTextAppearance = a.getResourceId(R.styleable.TextInputLayout_counterTextAppearance, 0);
mCounterOverflowTextAppearance =
a.getResourceId(R.styleable.TextInputLayout_counterOverflowTextAppearance, 0);
mPasswordToggleEnabled = a.getBoolean(R.styleable.TextInputLayout_passwordToggleEnabled, false);
mPasswordToggleDrawable = a.getDrawable(R.styleable.TextInputLayout_passwordToggleDrawable);
mPasswordToggleContentDesc =
a.getText(R.styleable.TextInputLayout_passwordToggleContentDescription);
if (a.hasValue(R.styleable.TextInputLayout_passwordToggleTint)) {
mHasPasswordToggleTintList = true;
mPasswordToggleTintList = a.getColorStateList(R.styleable.TextInputLayout_passwordToggleTint);
}
if (a.hasValue(R.styleable.TextInputLayout_passwordToggleTintMode)) {
mHasPasswordToggleTintMode = true;
mPasswordToggleTintMode =
ViewUtils.parseTintMode(
a.getInt(R.styleable.TextInputLayout_passwordToggleTintMode, -1), null);
}
a.recycle();
setErrorEnabled(errorEnabled);
setCounterEnabled(counterEnabled);
applyPasswordToggleTint();
if (ViewCompat.getImportantForAccessibility(this)
== ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
// Make sure we're important for accessibility if we haven't been explicitly not
ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
ViewCompat.setAccessibilityDelegate(this, new TextInputAccessibilityDelegate());
}
示例12: NumberAddSubView
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public NumberAddSubView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mInflater = LayoutInflater.from(context);
initView();
if(attrs !=null){
final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
R.styleable.NumberAddSubView, defStyleAttr, 0);
int val = a.getInt(R.styleable.NumberAddSubView_value,0);
setValue(val);
int maxVal = a.getInt(R.styleable.NumberAddSubView_maxValue,0);
if(maxVal!=0)
setMaxValue(maxVal);
int minVal = a.getInt(R.styleable.NumberAddSubView_minValue,0);
setMinValue(minVal);
Drawable etBackground = a.getDrawable(R.styleable.NumberAddSubView_editBackground);
if(etBackground!=null)
setEditTextBackground(etBackground);
Drawable buttonAddBackground = a.getDrawable(R.styleable.NumberAddSubView_buttonAddBackgroud);
if(buttonAddBackground!=null)
setButtonAddBackgroud(buttonAddBackground);
Drawable buttonSubBackground = a.getDrawable(R.styleable.NumberAddSubView_buttonSubBackgroud);
if(buttonSubBackground!=null)
setButtonSubBackgroud(buttonSubBackground);
a.recycle();
}
}
示例13: PVToolBar
import android.support.v7.widget.TintTypedArray; //导入方法依赖的package包/类
public PVToolBar(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.PVToolBar, defStyleAttr, 0);
final Drawable rightIcon = a.getDrawable(R.styleable.PVToolBar_rightButtonIcon);
if (rightIcon != null) {
//setNavigationIcon(navIcon);
setRightButtonIcon(rightIcon);
}
// int titleColor=a.getColor(R.styleable.PVToolBar_titleColor,-1);
// if(titleColor!=-1)
// mTextTitle.setTextColor(ContextCompat.getColor(context,titleColor));
boolean isShowSearchView = a.getBoolean(R.styleable.PVToolBar_isShowSearchView,false);
if(isShowSearchView){
showSearchView();
hideTitleView();
}
CharSequence rightButtonText = a.getText(R.styleable.PVToolBar_rightButtonText);
if(rightButtonText !=null){
setRightButtonText(rightButtonText);
}
a.recycle();
}
}