Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Style an Entry for android

$
0
0

Hi! I'm trying to style a entry with a color border and round corners, this is no problem on iOS but I want the same style on Android.

I'm not sure if it is posible to do it with styles on Android, I'm already using a style.xml for a splash and don't know if you can add more than one style to an app. On the other hand I have tried to use a renderer with no success:

public override void Draw(Canvas canvas)
{
CustomEntry entry = (CustomEntry)this.Element;

        //RoundedBoxView rbv = (RoundedBoxView)this.Element;

        Rect rc = new Rect();
        GetDrawingRect(rc);

        Rect interior = rc;
        interior.Inset(1, 1);

        Paint p = new Paint() {
                Color = Xamarin.Forms.Color.Blue.ToAndroid(),
            AntiAlias = true,
        };

        canvas.DrawRoundRect(new RectF(interior), 10, 10, p);

        p.Color = Xamarin.Forms.Color.Yellow.ToAndroid();
        p.StrokeWidth = 2;
        p.SetStyle(Paint.Style.Stroke);

        canvas.DrawRoundRect(new RectF(rc), (float)10, (float)10, p);
    }

The entry is shown properly but I cannot write on it.

Any help is welcome :D


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>