本文整理匯總了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;
}