Giter VIP home page Giter VIP logo

Comments (11)

ddobrev avatar ddobrev commented on July 17, 2024 3

When is this going to be released?

from xamarin.forms.

reense avatar reense commented on July 17, 2024 2

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

from xamarin.forms.

mohachouch avatar mohachouch commented on July 17, 2024 1

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.

image

from xamarin.forms.

andreinitescu avatar andreinitescu commented on July 17, 2024 1

Looking at https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.Android/Renderers/FrameRenderer.cs#L53 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.

from xamarin.forms.

Phenek avatar Phenek commented on July 17, 2024

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
            };

from xamarin.forms.

mohachouch avatar mohachouch commented on July 17, 2024

@Clovs What version of Xamarin Forms do you use?

from xamarin.forms.

Phenek avatar Phenek commented on July 17, 2024

Hello,
"Xamarin.Forms" version="2.5.0.280555" targetFramework="xamarinios10"

You can see on source code here: https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.Android/Renderers/FrameRenderer.cs
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:
https://developer.xamarin.com/api/type/Xamarin.Forms.Frame/

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

       public override void Draw(Canvas canvas)
       {
           base.Draw(canvas);
           using (var strokePaint = new Paint())
           using (var rect = new RectF(0, 0, canvas.Width, canvas.Height))
           {
               // stroke
               strokePaint.SetStyle(Paint.Style.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
Thanks,

from xamarin.forms.

jassmith avatar jassmith commented on July 17, 2024

This should be in 3.0.0

from xamarin.forms.

vhnatyk avatar vhnatyk commented on July 17, 2024

Hi! I'm still having issue with this on 3.2.0.839982 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)
    {
        base.Draw(canvas);

        if (Element == null || Element.BorderColor.A <= 0)
        {
            return;
        }

        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.SetStyle(style);
            paint.Color = Element.BorderColor.ToAndroid();
            canvas.DrawPath(path, paint);
        }
    }
}

}

from xamarin.forms.

D4rkC1own187 avatar D4rkC1own187 commented on July 17, 2024

This is still an issue. I'm using Xamarin.Form 4.0.0425677

from xamarin.forms.

PureWeen avatar PureWeen commented on July 17, 2024

@D4rkC1own187 can you create a new issue and try the latest?

from xamarin.forms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.