微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.util.AttributeSet的实例源码

项目:poturnoChat    文件SlidingTabStrip.java   
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();
}
项目:simple-keyboard    文件KeyboardBuilder.java   
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,"verticalGap");
        }
        return new KeyboardRow(mResources,mParams,parser,mCurrentY);
    } finally {
        keyboardAttr.recycle();
    }
}
项目:EyeShopping    文件CameraBridgeViewBase.java   
public CameraBridgeViewBase(Context 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();
}
项目:MiPushFramework    文件BottomNavigationItemView.java   
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);

}
项目:YMenuView    文件YMenu.java   
private void initAttr(Context context,AttributeSet attrs) {
    TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs,R.styleable.YMenuView,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();
}
项目:QiangHongBao    文件BorderCircleView.java   
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);
}
项目:aftercare-app-android    文件DCDashboardTeeth.java   
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();
}
项目:Spyglass    文件TestDimensionHandlerCombinations.java   
@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)));
}
项目:boohee_v5.6    文件ProgressIndicator.java   
public ProgressIndicator(Context context,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);
}
项目:Muse-EEG-Toolkit    文件EpochSurfaceView.java   
/** 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;
}
项目:simple-stack    文件MessageView.java   
public MessageView(Context context,attrs);
    setorientation(VERTICAL);
    Utils.getComponent(context).inject(this);

    MessagePath screen = Backstack.getKey(context);
    message = conversations.get(screen.conversationIndex()).items.get(screen.messageId());
}
项目:UiLib    文件EasySwitcher.java   
public EasySwitcher(Context context,attrs);
    mContext = context;
    mAllItemArray = new ArrayList<>();
    mDefaultSelection = 0;
    initBaseView();
}
项目:materialExpansionPanel    文件Expandable.java   
private void initAttrs(AttributeSet attrs) {
    if (attrs == null) return;

    TypedArray ta = getContext().getTheme().obtainStyledAttributes(attrs,R.styleable.Expandable,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,R.color.colorDefaultBackground));
    expandindicator = ta.getDrawable(R.styleable.Expandable_exp_expandindicator);

    ta.recycle();
}
项目:chromium-for-android-56-debug-video    文件TextScalePreference.java   
/**
 * Constructor for inflating from XML.
 */
public TextScalePreference(Context context,attrs);

    mFontSizePrefs = FontSizePrefs.getInstance(getContext());

    setLayoutResource(R.layout.custom_preference);
    setWidgetLayoutResource(R.layout.preference_text_scale);
}
项目:firebase-testlab-instr-lib    文件NoteEditor.java   
public LinedEditText(Context context,attrs);

    mRect = new Rect();
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.stroke);
    mPaint.setColor(0x800000FF);
}
项目:QMark    文件CornersFrameLayout.java   
public CornersFrameLayout(Context context,int defStyle) {
    super(context,defStyle);
    TypedArray a = context.obtainStyledAttributes(attrs,R.styleable.CornersFrameLayout,defStyle,0);
    mCornersRadius = a.getDimensionPixelOffset(R.styleable.CornersFrameLayout_cornersRadius,0);
    mAspectRatio = a.getFloat(R.styleable.CornersFrameLayout_cornersAspectRatio,0);
    a.recycle();
    init();
}
项目:anyRTC-Meeting-Android    文件CircleImageView.java   
public CircleImageView(Context context,defStyle);

    TypedArray a = context.obtainStyledAttributes(attrs,R.styleable.CircleImageView,0);

    mBorderWidth = a.getDimensionPixelSize(R.styleable.CircleImageView_civ_border_width,DEFAULT_BORDER_WIDTH);
    mBorderColor = a.getColor(R.styleable.CircleImageView_civ_border_color,DEFAULT_BORDER_COLOR);
    mBorderOverlay = a.getBoolean(R.styleable.CircleImageView_civ_border_overlay,DEFAULT_BORDER_OVERLAY);
    mFillColor = a.getColor(R.styleable.CircleImageView_civ_fill_color,DEFAULT_FILL_COLOR);

    a.recycle();

    init();
}
项目:Spyglass    文件WithDefaultToDpDimensionResource.java   
private void init(final AttributeSet attrs,final int defStyleAttr,final int defStyleRes) {
    WithDefaultToDpDimensionResource_SpyglassCompanion
            .builder()
            .withTarget(this)
            .withContext(getContext())
            .withStyleableResource(R.styleable.DimensionHandlerTestTargetBase)
            .withAttributeSet(attrs)
            .withDefaultStyleAttribute(defStyleAttr)
            .withDefaultStyleResource(defStyleRes)
            .build()
            .passDataToMethods();
}
项目:iosched-reader    文件BezelImageView.java   
public BezelImageView(Context context,defStyle);

    // Attribute initialization.
    final TypedArray a = context.obtainStyledAttributes(attrs,R.styleable.BezelImageView,0);

    mMaskDrawable = a.getDrawable(R.styleable.BezelImageView_maskDrawable);
    if (mMaskDrawable != null) {
        mMaskDrawable.setCallback(this);
    }

    mBorderDrawable = a.getDrawable(R.styleable.BezelImageView_borderDrawable);
    if (mBorderDrawable != null) {
        mBorderDrawable.setCallback(this);
    }

    mDesaturateOnPress = a.getBoolean(R.styleable.BezelImageView_desaturateOnPress,mDesaturateOnPress);

    a.recycle();

    // Other initialization.
    mBlackPaint = new Paint();
    mBlackPaint.setColor(0xff000000);

    mMaskedPaint = new Paint();
    mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));

    // Always want a cache allocated.
    mCacheBitmap = Bitmap.createBitmap(1,1,Bitmap.Config.ARGB_8888);

    if (mDesaturateOnPress) {
        // Create a desaturate color filter for pressed state.
        ColorMatrix cm = new ColorMatrix();
        cm.setSaturation(0);
        mDesaturateColorFilter = new ColorMatrixColorFilter(cm);
    }
}
项目:boohee_v5.6    文件DietShareEatItem.java   
public DietShareEatItem(Context context,defStyleAttr);
    mItem.put("breakfast",Integer.valueOf(R.drawable.pr));
    mItem.put("lunch",Integer.valueOf(R.drawable.pt));
    mItem.put("dinner",Integer.valueOf(R.drawable.ps));
    mItem.put(SNACK,Integer.valueOf(R.drawable.pq));
    mItem.put("sport",Integer.valueOf(R.drawable.pu));
    this.mView = LayoutInflater.from(getContext()).inflate(R.layout.os,null);
    addView(this.mView);
    ButterKnife.inject((View) this);
}
项目:AssistantBySDK    文件LoginoutButton.java   
/**
 * 初始化函数。
 * 
 * @param context 上下文环境,一般为放置该 Button 的 Activity 
 * @param attrs   XML 属性集合对象
 */
private void initialize(Context context,AttributeSet attrs) {
    mContext = context;
    this.setonClickListener(this);

    // 如果布局文件中未设置 style,加载认的 style
    loadDefaultStyle(attrs);
}
项目:LongImageCamera    文件Cameraview.java   
@SuppressWarnings("WrongConstant")
public Cameraview(Context context,defStyleAttr);
    if (isInEditMode()){
        mCallbacks = null;
        mdisplayOrientationDetector = null;
        return;
    }
    // Internal setup
    final PreviewImpl preview = createPreviewImpl(context);
    mCallbacks = new CallbackBridge();
    if (Build.VERSION.SDK_INT < 21) {
        mImpl = new Camera1(mCallbacks,preview);
    } else if (Build.VERSION.SDK_INT < 23) {
        mImpl = new Camera2(mCallbacks,preview,context);
    } else {
        mImpl = new Camera2Api23(mCallbacks,context);
    }
    // Attributes
    TypedArray a = context.obtainStyledAttributes(attrs,R.styleable.Cameraview,defStyleAttr,R.style.Widget_Cameraview);
    mAdjustViewBounds = a.getBoolean(R.styleable.Cameraview_android_adjustViewBounds,false);
    setFacing(a.getInt(R.styleable.Cameraview_facing,FACING_BACK));
    String aspectRatio = a.getString(R.styleable.Cameraview_aspectRatio);
    if (aspectRatio != null) {
        setAspectRatio(AspectRatio.parse(aspectRatio));
    } else {
        setAspectRatio(Constants.DEFAULT_ASPECT_RATIO);
    }
    setAutoFocus(a.getBoolean(R.styleable.Cameraview_autoFocus,true));
    setFlash(a.getInt(R.styleable.Cameraview_flash,Constants.FLASH_AUTO));
    a.recycle();
    // display orientation detector
    mdisplayOrientationDetector = new displayOrientationDetector(context) {
        @Override
        public void ondisplayOrientationChanged(int displayOrientation) {
            mImpl.setdisplayOrientation(displayOrientation);
        }
    };
}
项目:DizzyPassword    文件PswInputView.java   
/**
     * 初始化相关参数
     */
    void init(AttributeSet attrs) {
        final float dp = getResources().getdisplayMetrics().density;
        this.setFocusable(true);
        this.setFocusableInTouchMode(true);
        input = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        result = new ArrayList<>();
        if (attrs != null) {
            TypedArray ta = getContext().obtainStyledAttributes(attrs,R.styleable.PswInputView);
//            mBorderColor = ta.getColor(R.styleable.PswInputView_border_color,getResources().getColor(R.color.color_13));
            mBorderColor = ta.getColor(R.styleable.PswInputView_border_color,ThemeUtils.getPrimaryColor(AppManager.getAppManager().currentActivity()));
            mDotColor = ta.getColor(R.styleable.PswInputView_dot_color,getResources().getColor(R.color.color_bg));
            count = ta.getInt(R.styleable.PswInputView_count,6);
            ta.recycle();
        } else {
            mBorderColor = Color.LTGRAY;
            mDotColor = Color.GRAY;
            count = 6;//认6位密码
        }
        size = (int) (dp * 30);//认30dp一格
        //color
        mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mBorderPaint.setstrokeWidth(2);
        mBorderPaint.setStyle(Paint.Style.stroke);
        mBorderPaint.setColor(mBorderColor);
        mDotPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mDotPaint.setstrokeWidth(3);
        mDotPaint.setStyle(Paint.Style.FILL);
        mDotPaint.setColor(mDotColor);
        mRoundRect = new RectF();
        mRoundRadius = (int) (5 * dp);
        mFocusLineLength = 0;
        this.setonKeyListener(new MyKeyListener());
    }
项目:SnappyRecyclerView    文件SnappingRecyclerView.java   
public SnappingRecyclerView(Context context,@Nullable AttributeSet attrs,defStyle);
    initialise(context,attrs);
}
项目:PreviewSeekBar    文件PreviewGeneralLayout.java   
public PreviewGeneralLayout(Context context,defStyleAttr);
    init(context,attrs);
}
项目:TrendChartView    文件TrendChartView.java   
private void init(Context context,AttributeSet attrs) {
    initPaint();
}
项目:Cluttr    文件SquareFrameLayout.java   
public SquareFrameLayout(Context context,defStyleAttr);
}
项目:Idea-ijkplayer    文件TimeBarView.java   
public TimeBarView(Context context,AttributeSet attrs) {
    this(context,0);
}
项目:CXJPadProject    文件dishesView.java   
private dishesView(Context context,defStyleAttr);
    final TypedArray a= context.obtainStyledAttributes(attrs,R.styleable.dishesstyleable);
    updateBackgroundFromTypedArray(a);
    a.recycle();
}
项目:Hands-On-Android-UI-Development    文件ColorizedCardView.java   
public ColorizedCardView(
        final Context context,final AttributeSet attrs,final int defStyleAttr) {
    super(context,defStyleAttr);
}
项目:CustomListView    文件PullToRefreshBase.java   
public PullToRefreshBase(Context context,attrs);
    init(context,attrs);
}
项目:YCUtils    文件MaterialRippleLayout.java   
public MaterialRippleLayout(Context context,0);
}
项目:FontUtils    文件FontTextView.java   
public FontTextView(Context context,@Nullable AttributeSet attrs) {
    super(context,attrs);
}
项目:qmui    文件QMUICollapsingTopBarLayout.java   
public QMUICollapsingTopBarLayout(Context context,0);
}
项目:recyclviewpagger    文件MetalRecyclerViewPager.java   
public MetalRecyclerViewPager(Context context,defStyle);
    init(context,attrs);
}
项目:ImageFrame    文件ImageFrameView.java   
public ImageFrameView(Context context,@Nullable AttributeSet attrs) {
  super(context,attrs);
  init();
}
项目:pipe    文件SquareLayout.java   
public SquareLayout(@NonNull Context context,defStyleAttr);
}
项目:jbase    文件CustomViewPager.java   
public CustomViewPager(Context context,attrs);
}
项目:DailyStudy    文件SlideLayout.java   
public SlideLayout(@NonNull Context context,attrs);
    init(context);
}
项目:GitHub    文件EmptyRecyclerView.java   
public EmptyRecyclerView(Context context,attrs);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。