Issue
I want to be able to insert an image inside an input, make a binding if the mail is confirmed or not. I can't find any way to render the entry for IOS and android I want to achieve the followingenter image description here
I read the following but it is deprecated https://xamgirl.com/image-entry-in-xamarin-forms/
Solution
Per your requirement,it could be achieved by custom control with bindable property
.However, in Android Renderer, you need make small adjustments in BitmapDrawable
method like below:
private BitmapDrawable GetDrawable(string imageEntryImage)
{
int resID = Resources.GetIdentifier(imageEntryImage, "drawable", this.Context.PackageName);
var drawable = ContextCompat.GetDrawable(this.Context, resID);
var bitmap = ((BitmapDrawable)drawable).Bitmap;
if (Android.OS.Build.VERSION.SdkInt < Android.OS.BuildVersionCodes.P)
{
return new BitmapDrawable(Resources, Android.Graphics.Bitmap.CreateScaledBitmap(bitmap, element.ImageWidth * 2, element.ImageHeight * 2, true));
}
return new BitmapDrawable(Resources, Android.Graphics.Bitmap.CreateScaledBitmap(bitmap, element.ImageWidth, element.ImageHeight, true));
}
Consume the image entry in backend:
<local:ImageEntry TextColor="White"
BackgroundColor="Aqua"
Image="icon"
Placeholder="Email"
HorizontalOptions="FillAndExpand"/>
Running outcome in iOS:
Running outcome in Android:
Answered By - Alexandar May - MSFT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.