本文整理汇总了Java中android.util.AttributeSet.getAttributeBooleanValue方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeSet.getAttributeBooleanValue方法的具体用法?Java AttributeSet.getAttributeBooleanValue怎么用?Java AttributeSet.getAttributeBooleanValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.util.AttributeSet
的用法示例。
在下文中一共展示了AttributeSet.getAttributeBooleanValue方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractStateSet
import android.util.AttributeSet; //导入方法依赖的package包/类
/**
* Extracts state_ attributes from an attribute set.
*
* @param attrs The attribute set.
* @return An array of state_ attributes.
*/
protected int[] extractStateSet(AttributeSet attrs) {
int j = 0;
final int numAttrs = attrs.getAttributeCount();
int[] states = new int[numAttrs];
for (int i = 0; i < numAttrs; i++) {
final int stateResId = attrs.getAttributeNameResource(i);
if (stateResId == 0) {
break;
} else if (stateResId == android.R.attr.drawable
|| stateResId == android.R.attr.id
|| stateResId == R.attr.drawableTint
|| stateResId == R.attr.drawableTintMode) {
// Ignore attributes from StateListDrawableItem and
// AnimatedStateListDrawableItem.
continue;
} else {
states[j++] = attrs.getAttributeBooleanValue(i, false)
? stateResId : -stateResId;
}
}
states = StateSet.trimStateSet(states, j);
return states;
}
示例2: extractStateSet
import android.util.AttributeSet; //导入方法依赖的package包/类
protected static int[] extractStateSet(AttributeSet attrs) {
int j = 0;
final int numAttrs = attrs.getAttributeCount();
int[] states = new int[numAttrs];
for (int i = 0; i < numAttrs; i++) {
final int stateResId = attrs.getAttributeNameResource(i);
switch (stateResId) {
case 0:
break;
case android.R.attr.color:
case android.R.attr.alpha:
// Ignore attributes from StateListDrawableItem and
// AnimatedStateListDrawableItem.
continue;
default:
states[j++] = attrs.getAttributeBooleanValue(i, false)
? stateResId : -stateResId;
}
}
states = StateSet.trimStateSet(states, j);
return states;
}
示例3: onCreateView
import android.util.AttributeSet; //导入方法依赖的package包/类
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
// if this is NOT enable to be skined , simplly skip it
boolean isSkinEnable = attrs.getAttributeBooleanValue(SkinConfig.NAMESPACE, SkinConfig.ATTR_SKIN_ENABLE, false);
if (!isSkinEnable){
return null;
}
View view = createView(context, name, attrs);
if (view == null){
return null;
}
parseSkinAttr(context, attrs, view);
return view;
}
示例4: init
import android.util.AttributeSet; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs) {
mDensity = getContext().getResources().getDisplayMetrics().density;
setOnPreferenceClickListener(this);
if (attrs != null) {
mAlphaSliderEnabled = attrs.getAttributeBooleanValue(null, "alphaSlider", false);
mHexValueEnabled = attrs.getAttributeBooleanValue(null, "hexValue", false);
}
}
示例5: setAttributes
import android.util.AttributeSet; //导入方法依赖的package包/类
@Override
protected void setAttributes(AttributeSet attrs) {
super.setAttributes(attrs);
if (!isInEditMode()) {
getBackground().setAlpha(0);
}
iSchecked = attrs.getAttributeBooleanValue(MATERIALDESIGNXML, "checked", false);
eventCheck = iSchecked;
//添加监听器,如果点击了这个控件(不包括ball的区域),这个控件就开始判断是否是开启状态。
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
setChecked(iSchecked ? false : true);
}
});
float size = 20;
String thumbSize = attrs.getAttributeValue(MATERIALDESIGNXML, "thumbSize");
if (thumbSize != null) {
size = Utils.dipOrDpToFloat(thumbSize);
}
ball = new Ball(getContext());
setThumbParams(size);
addView(ball);
// 给圆球添加监听器,点击圆球后就开始判断是否进入开启状态
ball.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO 自动生成的方法存根
setChecked(iSchecked ? false : true);
}
});
}
示例6: setAttributes
import android.util.AttributeSet; //导入方法依赖的package包/类
@Override
protected void setAttributes(AttributeSet attrs) {
super.setAttributes(attrs);
if (!isInEditMode()) {
getBackground().setAlpha(0);
}
showNumberIndicator = attrs.getAttributeBooleanValue(MATERIALDESIGNXML,"showNumberIndicator", false);
min = attrs.getAttributeIntValue(MATERIALDESIGNXML, "min", 0);
max = attrs.getAttributeIntValue(MATERIALDESIGNXML, "max", 100);// max > min
value = attrs.getAttributeIntValue(MATERIALDESIGNXML, "value", min);
float size = 20;
String thumbSize = attrs.getAttributeValue(MATERIALDESIGNXML, "thumbSize");
if (thumbSize != null) {
size = Utils.dipOrDpToFloat(thumbSize);
}
ball = new Ball(getContext());
setBallParams(size);
addView(ball);
// Set if slider content number indicator
if (showNumberIndicator) {
if (!isInEditMode()) {
numberIndicator = new NumberIndicator(getContext());
}
}
}
示例7: setRippleAttributes
import android.util.AttributeSet; //导入方法依赖的package包/类
protected void setRippleAttributes(AttributeSet attrs) {
/**
* 初始化按压时涟漪的颜色
* Set Ripple Color
* Color by resource
*/
int color = attrs.getAttributeResourceValue(MATERIALDESIGNXML,"rippleColor",-1);
if(color != -1){
rippleColor = getResources().getColor(color);
settedRippleColor = true;
}else{
// Color by hexadecimal
int rColor = attrs.getAttributeIntValue(MATERIALDESIGNXML, "rippleColor", -1);// 16进制的颜色
if(rColor != -1 && !isInEditMode()) {
rippleColor = rColor;
settedRippleColor = true;
}
}
/**
* 初始化涟漪扩展的速度
* init Ripple speed
*/
rippleSpeed = attrs.getAttributeFloatValue(MATERIALDESIGNXML, "rippleSpeed", rippleSpeed);
/**
* 设定涟漪的响应时间
*/
clickAfterRipple = attrs.getAttributeBooleanValue(MATERIALDESIGNXML, "clickAfterRipple", clickAfterRipple);
}
示例8: onInitAttributes
import android.util.AttributeSet; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onInitAttributes(AttributeSet attrs) {
super.onInitAttributes(attrs);
// 设置按钮中的图标
int iconResource = attrs.getAttributeResourceValue(MATERIALDESIGNXML,"iconDrawable",-1);
if (iconResource != -1) {
iconDrawable = getResources().getDrawable(iconResource);
}
// animation
boolean animate = attrs.getAttributeBooleanValue(MATERIALDESIGNXML, "animate", false);
if (animate) {
playAnimation();
}
if (iconDrawable != null) {
icon.setBackgroundDrawable(iconDrawable);
}
// 设置按钮中图标的大小
String size = attrs.getAttributeValue(MATERIALDESIGNXML, "iconSize");
if (size != null) {
iconSize = (int) Utils.dipOrDpToFloat(size);
}
setIconParams();
addView(icon);
}
示例9: Button
import android.util.AttributeSet; //导入方法依赖的package包/类
public Button(Context context, AttributeSet attrs) {
super(context, attrs);
setDefaultProperties();
clickAfterRipple = attrs.getAttributeBooleanValue(MATERIALDESIGNXML,
"animate", true);
setAttributes(attrs);
beforeBackground = backgroundColor;
if (rippleColor == null)
rippleColor = makePressColor();
}
示例10: getAttributes
import android.util.AttributeSet; //导入方法依赖的package包/类
/**
* 解析 xml 文件
*
* @param attrs
*/
public void getAttributes(@Nullable AttributeSet attrs) {
String namespace = "http://schemas.android.com/apk/res-auto";
int switchBackground = attrs.getAttributeResourceValue(namespace, "switch_background", -1);
setBackgroundSwitchResource(switchBackground);
int slideButton = attrs.getAttributeResourceValue(namespace, "slide_button", -1);
setSlideButtonResource(slideButton);
boolean switchState = attrs.getAttributeBooleanValue(namespace, "switch_state", false);
setSwitchState(switchState);
}
示例11: AppPickerPreference
import android.util.AttributeSet; //导入方法依赖的package包/类
public AppPickerPreference(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
mResources = mContext.getResources();
mDefaultSummaryText = (String) getSummary();
mAppIconSizePx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40,
mResources.getDisplayMetrics());
mAppIconPreviewSizePx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 60,
mResources.getDisplayMetrics());
mIconPickSizePx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50,
mResources.getDisplayMetrics());
mPackageManager = mContext.getPackageManager();
mMode = MODE_APP;
mAppInfo = new AppInfo();
mAllowGravityBoxActions = true;
if (attrs != null) {
mIconPickerEnabled = attrs.getAttributeBooleanValue(null, "iconPickerEnabled", true);
mNullItemEnabled = attrs.getAttributeBooleanValue(null, "nullItemEnabled", true);
mForceCustomIcon = attrs.getAttributeBooleanValue(null, "forceCustomIcon", false);
mAllowGravityBoxActions = attrs.getAttributeBooleanValue(null, "allowGravityBoxActions", true);
}
setDialogLayoutResource(R.layout.app_picker_preference);
setPositiveButtonText(null);
if (sIconPickerAdapter == null) {
initializeIconPickerAdapter();
}
}
示例12: SeekBarPreference
import android.util.AttributeSet; //导入方法依赖的package包/类
public SeekBarPreference(Context context, AttributeSet attrs) {
super(context, attrs);
if (attrs != null) {
mMinimum = attrs.getAttributeIntValue(null, "minimum", 0);
mMaximum = attrs.getAttributeIntValue(null, "maximum", 100);
mInterval = attrs.getAttributeIntValue(null, "interval", 1);
mDefaultValue = mMinimum;
mMonitorBoxEnabled = attrs.getAttributeBooleanValue(null, "monitorBoxEnabled", false);
mMonitorBoxUnit = attrs.getAttributeValue(null, "monitorBoxUnit");
}
mHandler = new Handler();
}
示例13: TimePreference
import android.util.AttributeSet; //导入方法依赖的package包/类
public TimePreference(Context ctxt, AttributeSet attrs) {
super(ctxt, attrs);
mDefaultSummaryText = (String) super.getSummary();
if (attrs != null) {
mTimerMode = attrs.getAttributeBooleanValue(null, "timerMode", false);
}
setPositiveButtonText(android.R.string.ok);
setNegativeButtonText(android.R.string.cancel);
}
示例14: init
import android.util.AttributeSet; //导入方法依赖的package包/类
private void init(AttributeSet attributeSet) {
setLayoutResource(R.layout.preference_widget_color_picker);
if(attributeSet.getAttributeBooleanValue(null, "alphaSlider", false))
colorMode = ColorMode.ARGB;
}