コード例 #1
0
		public SlidingTabStrip(Context context, IAttributeSet Attrs):base(context, Attrs) {
			SetWillNotDraw(false);

			float density = Resources.DisplayMetrics.Density;

			TypedValue outValue = new TypedValue();
			context.Theme.ResolveAttribute(Android.Resource.Attribute.ColorForeground, outValue, true);
			int themeForegroundColor =  outValue.Data;

			_defaultBottomBorderColor = SetColorAlpha(themeForegroundColor,0x26);

			_defaultTabColorizer = new SimpleTabColorizer();
			_defaultTabColorizer.SetIndicatorColors(0xFF33B5);
			_defaultTabColorizer.SetDividerColors(SetColorAlpha(themeForegroundColor,0x20));

			_bottomBorderThickness = (int) (2 * density);
			_bottomBorderPaint = new Paint();
			_bottomBorderPaint.Color = Color.White;

			_selectedIndicatorThickness = (int) (6 * density);
			_selectedIndicatorPaint = new Paint();

			_dividerHeight = 0.5f;
			_dividerPaint = new Paint();
			_dividerPaint.StrokeWidth=((int) (1 * density));
		}
コード例 #2
0
        public SlidingTabStrip(Context context, IAttributeSet Attrs) : base(context, Attrs)
        {
            SetWillNotDraw(false);

            float density = Resources.DisplayMetrics.Density;

            TypedValue outValue = new TypedValue();

            context.Theme.ResolveAttribute(Android.Resource.Attribute.ColorForeground, outValue, true);
            int themeForegroundColor = outValue.Data;

            _defaultBottomBorderColor = SetColorAlpha(themeForegroundColor, 0x26);

            _defaultTabColorizer = new SimpleTabColorizer();
            _defaultTabColorizer.SetIndicatorColors(0xFF33B5);
            _defaultTabColorizer.SetDividerColors(SetColorAlpha(themeForegroundColor, 0x20));

            _bottomBorderThickness   = (int)(2 * density);
            _bottomBorderPaint       = new Paint();
            _bottomBorderPaint.Color = Color.White;

            _selectedIndicatorThickness = (int)(6 * density);
            _selectedIndicatorPaint     = new Paint();

            _dividerHeight            = 0.5f;
            _dividerPaint             = new Paint();
            _dividerPaint.StrokeWidth = ((int)(1 * density));
        }
コード例 #3
0
        public SlidingTabStrip(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            SetWillNotDraw(false);

            float density = Resources.DisplayMetrics.Density;

            TypedValue outValue = new TypedValue();
            context.Theme.ResolveAttribute(Android.Resource.Attribute.ColorForeground, outValue, true);
            int themeForegroundColor = outValue.Data;

            mDefaultBottomBorderColor = SetColorAlpha(themeForegroundColor, DEFAULT_BOTTOM_BORDER_COLOR_ALPHA);

            mDefaultTabColorizer = new SimpleTabColorizer();
            mDefaultTabColorizer.SetIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR);
            mDefaultTabColorizer.SetDividerColors(SetColorAlpha(themeForegroundColor, DEFAULT_DIVIDER_COLOR_ALPHA));

            mBottomBorderThickness = (int)(DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density);
            mBottomBorderPaint = new Paint();
            mBottomBorderPaint.Color = new Color(mDefaultBottomBorderColor);

            mSelectedIndicatorThickness = (int)(SELECTED_INDICATOR_THICKNESS_DIPS * density);
            mSelectedIndicatorPaint = new Paint();

            mDividerHeight = DEFAULT_DIVIDER_HEIGHT;
            mDividerPaint = new Paint();
            mDividerPaint.StrokeWidth = (int)(DEFAULT_DIVIDER_THICKNESS_DIPS * density);
        }
コード例 #4
0
        public SlidingTabStrip(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            SetWillNotDraw(false);

            float density = Resources.DisplayMetrics.Density;

            TypedValue outValue = new TypedValue();

            context.Theme.ResolveAttribute(Android.Resource.Attribute.ColorForeground, outValue, true);
            int themeForegroundColor = outValue.Data;

            mDefaultBottomBorderColor = SetColorAlpha(themeForegroundColor, DEFAULT_BOTTOM_BORDER_COLOR_ALPHA);

            mDefaultTabColorizer = new SimpleTabColorizer();
            mDefaultTabColorizer.SetIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR);
            mDefaultTabColorizer.SetDividerColors(SetColorAlpha(themeForegroundColor, DEFAULT_DIVIDER_COLOR_ALPHA));

            mBottomBorderThickness   = (int)(DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density);
            mBottomBorderPaint       = new Paint();
            mBottomBorderPaint.Color = new Color(mDefaultBottomBorderColor);

            mSelectedIndicatorThickness = (int)(SELECTED_INDICATOR_THICKNESS_DIPS * density);
            mSelectedIndicatorPaint     = new Paint();

            mDividerHeight            = DEFAULT_DIVIDER_HEIGHT;
            mDividerPaint             = new Paint();
            mDividerPaint.StrokeWidth = (int)(DEFAULT_DIVIDER_THICKNESS_DIPS * density);
        }
コード例 #5
0
        public SlidingTabStrip(Android.Content.Context context, IAttributeSet attrs)
            : base(context, attrs)
        {
            SetWillNotDraw(false);

            var density = Resources.DisplayMetrics.Density;

            var outValue = new TypedValue();

            context.Theme.ResolveAttribute(Android.Resource.Attribute.ColorForeground, outValue, true);
            var themeForegroundColor = outValue.Data;

            _defaultBottomBorderColor = SetColorAlpha(themeForegroundColor, DefaultBottomBorderColorAlpha);

            _defaultTabColorizer = new SimpleTabColorizer();
            _defaultTabColorizer.SetIndicatorColors(DefaultSelectedIndicatorColor);

            _bottomBorderThickness   = (int)(DefaultBottomBorderThicknessDips * density);
            _bottomBorderPaint       = new Paint();
            _bottomBorderPaint.Color = _defaultBottomBorderColor;

            _selectedIndicatorThickness = (int)(SelectedIndicatorThicknessDips * density);
            _selectedIndicatorPaint     = new Paint();
        }
コード例 #6
0
 public void SetSelectedIndicatorColors(params int[] colors)
 {
     mCustomTabColorizer = null;
     mDefaultTabColorizer.SetIndicatorColors(colors);
     Invalidate();
 }