예제 #1
0
파일: UILabel.cs 프로젝트: Gerhic/Need2Park
		public void SetCornerRadiusWithColor (Color backgroundColor, float[] arr)
		{
			GradientDrawable background = new GradientDrawable ();
			background.SetCornerRadii (arr);
			background.SetColor (backgroundColor);
			Background = background;
		}
예제 #2
0
        GradientDrawable CreateBackgroundDrawable(CornerSide setCornerSide, Android.Graphics.Color backgroundColor, float cornerRadius)
        {
            var gDrawable = new GradientDrawable(); 

            float[] corners;

            //Set X and Y for each corner 
            //The corners are ordered top-left, top-right, bottom-right, bottom-left
            switch (setCornerSide)
            {
                case CornerSide.LeftSide:
                    corners = new float[]{ cornerRadius, cornerRadius, DefaultCorner, DefaultCorner, DefaultCorner, DefaultCorner, cornerRadius, cornerRadius };  
                    break; 
                case CornerSide.RightSide:
                    corners = new float[]{ DefaultCorner, DefaultCorner, cornerRadius, cornerRadius, cornerRadius, cornerRadius, DefaultCorner, DefaultCorner };
                    break; 
                default :
                    corners = new float[]{ DefaultCorner, DefaultCorner, DefaultCorner, DefaultCorner, DefaultCorner, DefaultCorner, DefaultCorner, DefaultCorner };
                    break;
            }

            gDrawable.SetCornerRadii(corners);
            gDrawable.SetColor(backgroundColor.ToArgb());

            return gDrawable;
        }