Last active
July 19, 2018 20:53
-
-
Save baileysh9/10bf101ee6132d88ba2776d2d56f71ca to your computer and use it in GitHub Desktop.
Android implementation of the Gradient View Render
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void CreateGradient() | |
{ | |
//Need to convert the colors to Android Color objects | |
int[] androidColors = new int[gradientColors.Count()]; | |
for (int i = 0; i < gradientColors.Count(); i++) | |
{ | |
Xamarin.Forms.Color temp = gradientColors[i]; | |
androidColors[i] = temp.ToAndroid(); | |
} | |
GradientDrawable gradient = new GradientDrawable(GradientDrawable.Orientation.LeftRight, androidColors); | |
if (roundCorners) | |
gradient.SetCornerRadii(new float[] { cornerRadius, cornerRadius, cornerRadius, cornerRadius, cornerRadius, cornerRadius, cornerRadius, cornerRadius }); | |
layout.SetBackground(gradient); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what is this layout variable