コード例 #1
0
 static void OnLayoutChange(object sender, global::Android.Views.View.LayoutChangeEventArgs e)
 {
     if (sender is IVisualElementRenderer renderer && renderer.View is ImageView imageView)
     {
         AViewCompat.SetClipBounds(imageView, imageView.GetScaleType() == AScaleType.CenterCrop ? new ARect(0, 0, e.Right - e.Left, e.Bottom - e.Top) : null);
     }
 }
コード例 #2
0
ファイル: ItemsViewRenderer.cs プロジェクト: zmtzawqlp/maui
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);
            AViewCompat.SetClipBounds(this, new Rect(0, 0, Width, Height));

            // After a direct (non-animated) scroll operation, we may need to make adjustments
            // to align the target item; if an adjustment is pending, execute it here.
            // (Deliberately checking the private member here rather than the property accessor; the accessor will
            // create a new ScrollHelper if needed, and there's no reason to do that until a Scroll is requested.)
            _scrollHelper?.AdjustScroll();
        }