зеркало из https://github.com/DeGsoft/maui-linux.git
[Android] set ClipBounds to use ViewCompat.SetClipBounds (#4819)
This commit is contained in:
Родитель
761a04e27e
Коммит
7199cd099b
|
@ -5,6 +5,7 @@ using AScaleType = Android.Widget.ImageView.ScaleType;
|
|||
using ARect = Android.Graphics.Rect;
|
||||
using System;
|
||||
using Xamarin.Forms.Internals;
|
||||
using AViewCompat = Android.Support.V4.View.ViewCompat;
|
||||
|
||||
namespace Xamarin.Forms.Platform.Android.FastRenderers
|
||||
{
|
||||
|
@ -20,7 +21,7 @@ namespace Xamarin.Forms.Platform.Android.FastRenderers
|
|||
static void OnLayoutChange(object sender, global::Android.Views.View.LayoutChangeEventArgs e)
|
||||
{
|
||||
if(sender is IVisualElementRenderer renderer && renderer.View is ImageView imageView)
|
||||
imageView.ClipBounds = imageView.GetScaleType() == AScaleType.CenterCrop ? new ARect(0, 0, e.Right - e.Left, e.Bottom - e.Top) : null;
|
||||
AViewCompat.SetClipBounds(imageView, imageView.GetScaleType() == AScaleType.CenterCrop ? new ARect(0, 0, e.Right - e.Left, e.Bottom - e.Top) : null);
|
||||
}
|
||||
|
||||
public static void Dispose(IVisualElementRenderer renderer)
|
||||
|
|
Загрузка…
Ссылка в новой задаче