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


Java AttributeSet类代码示例

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


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

示例1: testSpyglassCallsMethod_attributeMissing_defaultToNullPresent

import android.util.AttributeSet; //导入依赖的package包/类
@Test
@UiThreadTest
public void testSpyglassCallsMethod_attributeMissing_defaultToNullPresent() {
	final AttributeSet attrs = fromXml(context, R.xml.dimension_handler_without_attr);

	final DimensionHandlerTestTargetBase target = new WithDefaultToNull(context, attrs);

	assertThat(target.getReceivedValue(), is(ReceivedValue.<Integer>of(null)));
}
 
开发者ID:MatthewTamlin,项目名称:Spyglass,代码行数:10,代码来源:TestDimensionHandlerCombinations.java

示例2: SlidingTabStrip

import android.util.AttributeSet; //导入依赖的package包/类
SlidingTabStrip(Context context, AttributeSet attrs) {
    super(context, attrs);
    setWillNotDraw(false);

    final float density = getResources().getDisplayMetrics().density;

    TypedValue outValue = new TypedValue();
    context.getTheme().resolveAttribute(android.R.attr.colorForeground, outValue, true);
    final int themeForegroundColor =  outValue.data;

    int defaultBottomBorderColor = setColorAlpha(themeForegroundColor,
            DEFAULT_BOTTOM_BORDER_COLOR_ALPHA);

    mDefaultTabColorizer = new SimpleTabColorizer();
    mDefaultTabColorizer.setIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR);

    mBottomBorderThickness = (int) (DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density);
    mBottomBorderPaint = new Paint();
    mBottomBorderPaint.setColor(defaultBottomBorderColor);

    mSelectedIndicatorThickness = (int) (SELECTED_INDICATOR_THICKNESS_DIPS * density);
    mSelectedIndicatorPaint = new Paint();
}
 
开发者ID:VitorPoncell,项目名称:poturnoChat,代码行数:24,代码来源:SlidingTabStrip.java

示例3: parseRowAttributes

import android.util.AttributeSet; //导入依赖的package包/类
private KeyboardRow parseRowAttributes(final XmlPullParser parser)
        throws XmlPullParserException {
    final AttributeSet attr = Xml.asAttributeSet(parser);
    final TypedArray keyboardAttr = mResources.obtainAttributes(attr, R.styleable.Keyboard);
    try {
        if (keyboardAttr.hasValue(R.styleable.Keyboard_horizontalGap)) {
            throw new XmlParseUtils.IllegalAttribute(parser, TAG_ROW, "horizontalGap");
        }
        if (keyboardAttr.hasValue(R.styleable.Keyboard_verticalGap)) {
            throw new XmlParseUtils.IllegalAttribute(parser, TAG_ROW, "verticalGap");
        }
        return new KeyboardRow(mResources, mParams, parser, mCurrentY);
    } finally {
        keyboardAttr.recycle();
    }
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:17,代码来源:KeyboardBuilder.java

示例4: 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:jmpaaak,项目名称:EyeShopping,代码行数:18,代码来源:CameraBridgeViewBase.java

示例5: BottomNavigationItemView

import android.util.AttributeSet; //导入依赖的package包/类
public BottomNavigationItemView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    final Resources res = getResources();
    int inactiveLabelSize =
            res.getDimensionPixelSize(R.dimen.design_bottom_navigation_text_size);
    int activeLabelSize = res.getDimensionPixelSize(
            R.dimen.design_bottom_navigation_active_text_size);
    mDefaultMargin = res.getDimensionPixelSize(R.dimen.design_bottom_navigation_margin);
    mShiftAmount = inactiveLabelSize - activeLabelSize;
    mScaleUpFactor = 1f * activeLabelSize / inactiveLabelSize;
    mScaleDownFactor = 1f * inactiveLabelSize / activeLabelSize;

    LayoutInflater.from(context).inflate(R.layout.design_bottom_navigation_item, this, true);
    setBackgroundResource(R.drawable.design_bottom_navigation_item_background);
    mIcon = (ImageView) findViewById(R.id.icon);
    mSmallLabel = (TextView) findViewById(R.id.smallLabel);
    mLargeLabel = (TextView) findViewById(R.id.largeLabel);

}
 
开发者ID:Trumeet,项目名称:MiPushFramework,代码行数:20,代码来源:BottomNavigationItemView.java

示例6: initAttr

import android.util.AttributeSet; //导入依赖的package包/类
private void initAttr(Context context, AttributeSet attrs) {
    TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.YMenuView, 0, 0);
    mYMenuButtonWidth = typedArray.getDimensionPixelSize(R.styleable.YMenuView_menuButtonWidth, mYMenuButtonWidth);
    mYMenuButtonHeight = typedArray.getDimensionPixelSize(R.styleable.YMenuView_menuButtonHeight, mYMenuButtonHeight);
    mYOptionButtonWidth = typedArray.getDimensionPixelSize(R.styleable.YMenuView_optionButtonWidth, mYOptionButtonWidth);
    mYOptionButtonHeight = typedArray.getDimensionPixelSize(R.styleable.YMenuView_optionButtonHeight, mYOptionButtonHeight);
    mYMenuToParentXMargin = typedArray.getDimensionPixelSize(R.styleable.YMenuView_menuToParentXMargin, mYMenuToParentXMargin);
    mYMenuToParentYMargin = typedArray.getDimensionPixelSize(R.styleable.YMenuView_menuToParentYMargin, mYMenuToParentYMargin);
    optionPositionCount = typedArray.getInteger(R.styleable.YMenuView_optionPositionCounts, optionPositionCount);
    optionColumns = typedArray.getInteger(R.styleable.YMenuView_optionColumns, optionColumns);
    mYOptionToParentYMargin = typedArray.getDimensionPixelSize(R.styleable.YMenuView_optionToParentYMargin, mYOptionToParentYMargin);
    mYOptionToParentXMargin = typedArray.getDimensionPixelSize(R.styleable.YMenuView_optionToParentXMargin, mYOptionToParentXMargin);
    mYOptionYMargin = typedArray.getDimensionPixelSize(R.styleable.YMenuView_optionYMargin, mYOptionYMargin);
    mYOptionXMargin = typedArray.getDimensionPixelSize(R.styleable.YMenuView_optionXMargin, mYOptionXMargin);
    mMenuButtonBackGroundId = typedArray.getResourceId(R.styleable.YMenuView_menuButtonBackGround, mMenuButtonBackGroundId);
    mOptionsBackGroundId = typedArray.getResourceId(R.styleable.YMenuView_optionsBackGround, R.drawable.null_drawable);
    mOptionSD_AnimationMode = typedArray.getInt(R.styleable.YMenuView_sd_animMode, mOptionSD_AnimationMode);
    mOptionSD_AnimationDuration = typedArray.getInt(R.styleable.YMenuView_sd_duration, mOptionSD_AnimationDuration);
    isShowMenu = typedArray.getBoolean(R.styleable.YMenuView_isShowMenu, isShowMenu);

    typedArray.recycle();
}
 
开发者ID:totond,项目名称:YMenuView,代码行数:23,代码来源:YMenu.java

示例7: init

import android.util.AttributeSet; //导入依赖的package包/类
private void init(Context context, AttributeSet attrs) {
    borderWidth = DisplayUtils.converDip2px(1);
    backgroundColor = Color.TRANSPARENT;
    borderColor = Color.BLACK;

    if (attrs != null) {
        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.BorderCircleView);
        borderWidth = ta.getDimensionPixelSize(R.styleable.BorderCircleView_borderWidth, borderWidth);
        backgroundColor = ta.getColor(R.styleable.BorderCircleView_backgroundColor, backgroundColor);
        borderColor = ta.getColor(R.styleable.BorderCircleView_borderCircleColor, borderColor);
        ta.recycle();
    }

    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(backgroundColor);

    paintBorder = new Paint();
    paintBorder.setAntiAlias(true);
    paintBorder.setStyle(Paint.Style.STROKE);
    paintBorder.setColor(borderColor);

    setBackground(null);
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:26,代码来源:BorderCircleView.java

示例8: init

import android.util.AttributeSet; //导入依赖的package包/类
private void init(AttributeSet attributeSet) {
    inflate(getContext(), R.layout.view_dashboard_teeth, this);

    teeth = new DCTooth[32];
    for (int i = 0; i < 32; i++) {
        teeth[i] = (DCTooth) findViewById(getResources().getIdentifier("iv_t" + (i + 1), "id", getContext().getPackageName()));
    }

    hideAll();
}
 
开发者ID:Dentacoin,项目名称:aftercare-app-android,代码行数:11,代码来源:DCDashboardTeeth.java

示例9: ProgressIndicator

import android.util.AttributeSet; //导入依赖的package包/类
public ProgressIndicator(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    this.mParams = new LayoutParams(-2, -2);
    this.cpIndicator = new CircleProgress(this, context);
    addView(this.cpIndicator);
    this.mParams.addRule(13);
    this.mParams.setMargins(24, 24, 24, 24);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:ProgressIndicator.java

示例10: EpochSurfaceView

import android.util.AttributeSet; //导入依赖的package包/类
/** Creates a SurfaceView graph by parsing attributes. */
public EpochSurfaceView(Context context, AttributeSet attrs) {
  super(context, attrs);
  setWillNotDraw(false);

  int color = Color.BLACK;
  for (int i = 0; i < attrs.getAttributeCount(); i++) {
    if ("lineColor".equals(attrs.getAttributeName(i))) {
      color = Color.parseColor(attrs.getAttributeValue(i));
    }
  }
  this.color = color;
}
 
开发者ID:padster,项目名称:Muse-EEG-Toolkit,代码行数:14,代码来源:EpochSurfaceView.java

示例11: MessageView

import android.util.AttributeSet; //导入依赖的package包/类
public MessageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    setOrientation(VERTICAL);
    Utils.getComponent(context).inject(this);

    MessagePath screen = Backstack.getKey(context);
    message = conversations.get(screen.conversationIndex()).items.get(screen.messageId());
}
 
开发者ID:Zhuinden,项目名称:simple-stack,代码行数:9,代码来源:MessageView.java

示例12: EasySwitcher

import android.util.AttributeSet; //导入依赖的package包/类
public EasySwitcher(Context context, AttributeSet attrs) {
    super(context, attrs);
    mContext = context;
    mAllItemArray = new ArrayList<>();
    mDefaultSelection = 0;
    initBaseView();
}
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:8,代码来源:EasySwitcher.java

示例13: initAttrs

import android.util.AttributeSet; //导入依赖的package包/类
private void initAttrs(AttributeSet attrs) {
    if (attrs == null) return;

    TypedArray ta = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.Expandable, 0, 0);

    icon = ta.getDrawable(R.styleable.Expandable_exp_icon);
    iconStyle = ta.getInt(R.styleable.Expandable_exp_iconStyle, ExpandableUtils.ICON_STYLE_SQUARE);
    animateExpand = ta.getBoolean(R.styleable.Expandable_exp_animateExpand, false);
    backgroundColor = ta.getColor(R.styleable.Expandable_exp_backgroundColor, ContextCompat.getColor(getContext(), R.color.colorDefaultBackground));
    headerBackgroundColor = ta.getColor(R.styleable.Expandable_exp_headerBackgroundColor, ContextCompat.getColor(getContext(), R.color.colorDefaultBackground));
    expandIndicator = ta.getDrawable(R.styleable.Expandable_exp_expandIndicator);

    ta.recycle();
}
 
开发者ID:robertlevonyan,项目名称:materialExpansionPanel,代码行数:15,代码来源:Expandable.java

示例14: TextScalePreference

import android.util.AttributeSet; //导入依赖的package包/类
/**
 * Constructor for inflating from XML.
 */
public TextScalePreference(Context context, AttributeSet attrs) {
    super(context, attrs);

    mFontSizePrefs = FontSizePrefs.getInstance(getContext());

    setLayoutResource(R.layout.custom_preference);
    setWidgetLayoutResource(R.layout.preference_text_scale);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:12,代码来源:TextScalePreference.java

示例15: LinedEditText

import android.util.AttributeSet; //导入依赖的package包/类
public LinedEditText(Context context, AttributeSet attrs) {
    super(context, attrs);
    
    mRect = new Rect();
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setColor(0x800000FF);
}
 
开发者ID:firebase,项目名称:firebase-testlab-instr-lib,代码行数:9,代码来源:NoteEditor.java


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