New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Frame outline color not rendering #1347

davidortinau opened this Issue Dec 7, 2017 · 9 comments


None yet
10 participants

davidortinau commented Dec 7, 2017


Migrated from

The original issue was that the color wouldn't appear unless padding was set. In my sample I don't see the color on Android at all. iOS renders as I'd expect.

screenshot 2017-12-07 08 14 26

Steps to Reproduce

  1. Create a Frame with an outline color.
  2. Run and observe on Android the outline doesn't show the color.

Expected Behavior

The outline should be the color I've chosen, regardless of padding.

Actual Behavior

iOS renders as expected. Android outline isn't the chosen color, red.

Basic Information

  • Version with issue:
  • IDE: VS Mac
  • Platform Target Frameworks:
    • iOS: 11.1
    • Android: 7.1 running on 8.0 using FormsAppCompatActivity
  • Android Support Library Version:

Reproduction Link


This comment has been minimized.


mohachouch commented Dec 8, 2017

CarView has no property to change the color of this border. You have to use a GradientDrawable in background. I can fix this bug if you wish.


@jassmith jassmith removed this from Backlog in v3.1.0 Dec 11, 2017

@jassmith jassmith added this to New in Triage via automation Dec 11, 2017

@jassmith jassmith moved this from New to Ready For Work in Triage Dec 11, 2017

Triage automation moved this from Ready For Work to Invalid Jan 3, 2018


This comment has been minimized.

ddobrev commented Mar 14, 2018

When is this going to be released?


This comment has been minimized.

Phenek commented Mar 22, 2018

Still got this issue on Android

_FrameLayout = new Frame
                Padding = 20,
                Margin = 10,
                BackgroundColor = Color.White,
                Content = View,
                HasShadow = true,
                OutlineColor = Color.Red,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Center

This comment has been minimized.


mohachouch commented Mar 22, 2018

@clovs What version of Xamarin Forms do you use?


This comment has been minimized.

Phenek commented Mar 23, 2018

"Xamarin.Forms" version="" targetFramework="xamarinios10"

You can see on source code here:
They use a BorderColor property from Frame Object,
But I got no one! @StephaneDelcroix

I just got an OutlineColor property. like describe in the doc:

So I just redraw a stroke with OutlineColor property on the canvas with custom renderer:
Here my code:

       public override void Draw(Canvas canvas)
           using (var strokePaint = new Paint())
           using (var rect = new RectF(0, 0, canvas.Width, canvas.Height))
               // stroke
               strokePaint.Color = Element.OutlineColor.ToAndroid();
               strokePaint.StrokeWidth = 5;

               canvas.DrawRoundRect(rect, Element.CornerRadius, Element.CornerRadius, strokePaint);  // stroke

And Done!
but it still an issue, you can open it


This comment has been minimized.


andreinitescu commented Mar 23, 2018

Looking at UpdateBackground() and UpdateCornerRadius() are being called but both do same thing:

	void UpdateBackground()
		this.SetBackground(new FrameDrawable(Element, Context.ToPixels));

	void UpdateCornerRadius()
		this.SetBackground(new FrameDrawable(Element, Context.ToPixels));

This ends up in calling SetBackground and creating FrameDrawable twice.
This hurts performance and it should be necessary...

Another thing: in the FrameDrawable ctor, I see subscription to the PropertyChanged event of the Xamarin.Forms.Frame instance. I can't see where it's unsubscribing from the event. I haven't though if it's really needed it or not though.

@samhouts samhouts reopened this Mar 23, 2018

Triage automation moved this from Closed to Reopened Mar 23, 2018


This comment has been minimized.

reense commented Apr 3, 2018

This issue is still very much a thing. Any updates?


This comment has been minimized.


jassmith commented Apr 7, 2018

This should be in 3.0.0

@jassmith jassmith closed this Apr 7, 2018

Triage automation moved this from Reopened to Closed Apr 7, 2018

@samhouts samhouts removed this from Closed in Triage Jun 12, 2018


This comment has been minimized.

vhnatyk commented Oct 29, 2018

Hi! I'm still having issue with this on on Android - on iOS, Google Android simulators all ok - but on Android devices, Frame doesn't draw as expected. I use it to make a single pixel line - but on android devices it has only background. Fixed with a renderer

using Android.Content;
using Android.Graphics;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

[assembly: ExportRenderer(typeof(SeparatorLine), typeof(SeparatorLineRenderer))]
namespace TechPortal.Droid.Controls
public class SeparatorLineRenderer : FrameRenderer
public SeparatorLineRenderer(Context context) : base(context)

    public override void Draw(Canvas canvas)

        if (Element == null || Element.BorderColor.A <= 0)

        using (var paint = new Paint
            AntiAlias = true

        using (var path = new Path())
        using (Path.Direction direction = Path.Direction.Cw)
        using (Paint.Style style = Paint.Style.Stroke)
        using (var rect = new RectF(0, 0, canvas.Width, canvas.Height))
            var raduis = Android.App.Application.Context.ToPixels(Element.CornerRadius);
            path.AddRoundRect(rect, raduis, raduis, direction);
            //paint.StrokeWidth = Context.Resources.DisplayMetrics.Density * 2;  
            paint.Color = Element.BorderColor.ToAndroid();
            canvas.DrawPath(path, paint);


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment