当前位置: 首页>>代码示例>>Java>>正文


Java AttributeSet.getAttributeCount方法代码示例

本文整理汇总了Java中android.util.AttributeSet.getAttributeCount方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeSet.getAttributeCount方法的具体用法?Java AttributeSet.getAttributeCount怎么用?Java AttributeSet.getAttributeCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.util.AttributeSet的用法示例。


在下文中一共展示了AttributeSet.getAttributeCount方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CameraBridgeViewBase

import android.util.AttributeSet; //导入方法依赖的package包/类
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);

    int count = attrs.getAttributeCount();
    Log.d(TAG, "Attr count: " + Integer.valueOf(count));

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
    if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
        enableFpsMeter();

    mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);

    getHolder().addCallback(this);
    mMaxWidth = MAX_UNSPECIFIED;
    mMaxHeight = MAX_UNSPECIFIED;
    styledAttrs.recycle();
}
 
开发者ID:beast,项目名称:react-native-scan-doc,代码行数:18,代码来源:CameraBridgeViewBase.java

示例2: 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;
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:30,代码来源:DrawableUtils.java

示例3: NS_MOBILE_EXTRA

import android.util.AttributeSet; //导入方法依赖的package包/类
public NS_MOBILE_EXTRA(Context context, AttributeSet attrs) {
    super(context, attrs);
    setDialogLayoutResource(R.layout.preference_seekbar);

    for (int i = 0; i < attrs.getAttributeCount(); i++) {
        String attr = attrs.getAttributeName(i);
        if (attr.equalsIgnoreCase("pref_kind")) {
            prefKind = attrs.getAttributeValue(i);
            break;
        }
    }
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:13,代码来源:NS_MOBILE_EXTRA.java

示例4: getSrcId

import android.util.AttributeSet; //导入方法依赖的package包/类
private static int getSrcId(AttributeSet attrs) {
    int count = attrs.getAttributeCount();
    for (int i = 0; i < count; i++) {
        if (attrs.getAttributeNameResource(i) == android.R.attr.src) {
            String str = attrs.getAttributeValue(i);
            return Integer.valueOf(str.substring(1, str.length()));
        }
    }
    return -1;
}
 
开发者ID:vitaviva,项目名称:MultipleTheme,代码行数:11,代码来源:ThemedImageView.java

示例5: getAttributeValue

import android.util.AttributeSet; //导入方法依赖的package包/类
public static int getAttributeValue(AttributeSet attr, int paramInt) {
    int value = -1;
    int count = attr.getAttributeCount();
    for(int i = 0; i <count;i++) {
        if(attr.getAttributeNameResource(i) == paramInt) {
            String str = attr.getAttributeValue(i);
            if(null != str && str.startsWith("?")) {
                value = Integer.valueOf(str.substring(1,str.length())).intValue();
                return value;
            }
        }
    }
    return value;
}
 
开发者ID:vitaviva,项目名称:MultipleTheme,代码行数:15,代码来源:ViewAttributeUtil.java

示例6: ConnectionStrengthView

import android.util.AttributeSet; //导入方法依赖的package包/类
/** Creates an HSI view by parsing attributes. */
public ConnectionStrengthView(Context context, AttributeSet attrs) {
  super(context, attrs);

  int backgroundColor = Color.BLACK;
  for (int i = 0; i < attrs.getAttributeCount(); i++) {
    if ("backgroundColor".equals(attrs.getAttributeName(i))) {
      backgroundColor = Color.parseColor(attrs.getAttributeValue(i));
    }
  }
  backgroundPaint.setColor(backgroundColor);
  backgroundPaint.setStyle(Paint.Style.FILL_AND_STROKE);

  setWillNotDraw(false);
}
 
开发者ID:padster,项目名称:Muse-EEG-Toolkit,代码行数:16,代码来源:ConnectionStrengthView.java

示例7: CameraPreviewUVC

import android.util.AttributeSet; //导入方法依赖的package包/类
public CameraPreviewUVC(Context context, AttributeSet attrs) {
      super(context, attrs);
      setFocusable(true);
      this.holder = getHolder();
      this.holder.addCallback(this);
mUsbMonitor = new USBMonitor(context, mOnDeviceConnectListener);
refreshDevice();

      int n = attrs.getAttributeCount();
if (n <= 0) {
	mCameraId = 0;
} else {
	for (int i = 0; i < n; i++) {
		String name = attrs.getAttributeName(i);
		String value = attrs.getAttributeValue(i);
		if (name == null || value == null) {
			continue;
		}
		if (name.equals("camType") && value.equals("front")) { 
			mIsFront  = true;
		}
		// camera id
		if (name.equals("camId")) { 
			mCameraId = Integer.parseInt(value);
		}
		
		if (mCameraId < 0) {
			mCameraId = 0; 
		}
		// width 
		if (name.equals("width")) {
			mWidth = Integer.parseInt(value);
		}
		// height 
		if (name.equals("height")) {
			mHeight = Integer.parseInt(value);
		}
		if (mWidth <= 0 || mHeight <= 0) {
			Log.d(TAG, "Wrong preview size "+mWidth+"x"+mHeight);
		}
		// scaleType
		if (name.equals("scaleType")) {
			if (value.equals("center")) {
				mScaleType = SCALE_TYPE_CENTER;
			} else if (value.equals("centerCrop")) {
				mScaleType = SCALE_TYPE_CENTER_CROP;
			} else {
				mScaleType = SCALE_TYPE_FIT;
			}
		}
	}
}
  }
 
开发者ID:wjchen,项目名称:AndroidUvcCameras,代码行数:54,代码来源:CameraPreviewUVC.java

示例8: CameraPreviewV4L

import android.util.AttributeSet; //导入方法依赖的package包/类
public CameraPreviewV4L(Context context, AttributeSet attrs) {
      super(context, attrs);
      setFocusable(true);
      this.holder = getHolder();
      this.holder.addCallback(this);
      int n = attrs.getAttributeCount();
if (n <= 0) {
	mCameraId = 0;
} else {
	for (int i = 0; i < n; i++) {
		String name = attrs.getAttributeName(i);
		String value = attrs.getAttributeValue(i);
		if (name == null || value == null) {
			continue;
		}
		if (name.equals("camType") && value.equals("front")) {
			mIsFront = true;
		}
		// camera id
		if (name.equals("camId")) { 
			mCameraId = Integer.parseInt(value);
		}
		
		if (mCameraId < 0) {
			mCameraId = 0; 
		}
		// width 
		if (name.equals("width")) {
			mWidth = Integer.parseInt(value);
		}
		// height 
		if (name.equals("height")) {
			mHeight = Integer.parseInt(value);
		}
		if (mWidth <= 0 || mHeight <= 0) {
			Log.d(TAG, "Wrong preview size "+mWidth+"x"+mHeight);
		}
		// scaleType
		if (name.equals("scaleType")) {
			if (value.equals("center")) {
				mScaleType = SCALE_TYPE_CENTER;
			} else if (value.equals("centerCrop")) {
				mScaleType = SCALE_TYPE_CENTER_CROP;
			} else {
				mScaleType = SCALE_TYPE_FIT;
			}
		}
	}
}
  }
 
开发者ID:wjchen,项目名称:AndroidUvcCameras,代码行数:51,代码来源:CameraPreviewV4L.java


注:本文中的android.util.AttributeSet.getAttributeCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。