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));
		}
Example #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));
        }
        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);
        }
        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);
        }
 public void SetDividerColors(params int[] colors)
 {
     mCustomTabColorizer = null;
     mDefaultTabColorizer.SetDividerColors(colors);
     Invalidate();
 }