當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。