Hi, im getting
'Xamarin.Forms.Platform.Android.EditorEditText' does not contain a definition for 'Layer' and no extension method 'Layer' accepting a first argument of type 'Xamarin.Forms.Platform.Android.EditorEditText' could be found.
For border colour on Android you need to look at using a GradientDrawable. You set up the GradientDrawable with the colour settings you need: use SetColor to set the color of the internals of the drawable, and SetStroke to set the border width and colour; use SetCornerRadius if you need to round the corners. Then finally use Control.SetBackgroundDrawable in the renderer to set the GradientDrawable as the background for the control.
For border colour on Android you need to look at using a GradientDrawable. You set up the GradientDrawable with the colour settings you need: use SetColor to set the color of the internals of the drawable, and SetStroke to set the border width and colour; use SetCornerRadius if you need to round the corners. Then finally use Control.SetBackgroundDrawable in the renderer to set the GradientDrawable as the background for the control.
Posts
On which platform?
Preferably iOS and Android but I'll take either one.
This is a custom renderer for an Entry on iOS. It doesn't do a colored border, but it at least shows some of the concepts that you need to understand.
Xamarin University: Custom Renderers in Xamarin.Forms
Xamarin Evolve 2014: Extending Xamarin.Forms with Custom Controls - Jason Smith, Xamarin
XLabs project has a custom editor control too:
https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/src/Forms/XLabs.Forms.iOS/Controls/ExtendedEditor/ExtendedEditorRenderer.cs
https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/src/Forms/XLabs.Forms.Droid/Controls/ExtendedEditor/ExtendedEditorRenderer.cs
https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/src/Forms/XLabs.Forms/Controls/ExtendedEditor.cs
Hi, im getting
'Xamarin.Forms.Platform.Android.EditorEditText' does not contain a definition for 'Layer' and no extension method 'Layer' accepting a first argument of type 'Xamarin.Forms.Platform.Android.EditorEditText' could be found.
What can be the problem?
These are iOS APIs. You have to do something different for Android.
Do you have an example code for changing the editor border color in android? I cant find it.
No, I don't. You can ask about that on the Xamarin.Android forums to find people who know more about Android APIs.
For border colour on Android you need to look at using a
GradientDrawable
. You set up theGradientDrawable
with the colour settings you need: useSetColor
to set the color of the internals of the drawable, andSetStroke
to set the border width and colour; useSetCornerRadius
if you need to round the corners. Then finally useControl.SetBackgroundDrawable
in the renderer to set theGradientDrawable
as the background for the control.For border colour on Android you need to look at using a
GradientDrawable
. You set up theGradientDrawable
with the colour settings you need: useSetColor
to set the color of the internals of the drawable, andSetStroke
to set the border width and colour; useSetCornerRadius
if you need to round the corners. Then finally useControl.SetBackgroundDrawable
in the renderer to set theGradientDrawable
as the background for the control.