コード例 #1
0
 /// <summary>
 /// Sets the position of the button afterwards for all android versions below Lollipop, where the calculated fabSize is not correct.
 /// This repositioning cannot be done in the OnSizeAllocated method because the button have to be
 /// added first to get the right button width and height.
 /// </summary>
 private void SetButtonPosition(double width)
 {
     Button.SizeChanged += (sender, e) =>
     {
         var buttonRect = new Rectangle
         {
             Top  = Height - bottomSheetSize - Button.Height / 2,
             Size = new Size(Button.Width, Button.Height),
             X    = width - buttonRightPadding - Button.Width
         };
         Button.LayoutTo(buttonRect, 0);
     };
 }
コード例 #2
0
        /// <summary>
        /// Layout the bottom sheet to its extended state, with animation.
        /// </summary>
        /// <returns>The task.</returns>
        private async Task ExtendBottomSheet()
        {
            Rectangle bottomSheetRect = new Rectangle
            {
                Left = 0,
                Top  = Height * (1 - bottomSheetExtensionFraction),
                Size = new Size(Width, Height * bottomSheetExtensionFraction)
            };
            Rectangle buttonRect = new Rectangle
            {
                Top  = bottomSheetRect.Top - Button.Height / 2,
                Size = new Size(Button.Width, Button.Height),
                X    = Button.X
            };
            await Task.WhenAll(BottomSheetContentView.LayoutTo(bottomSheetRect), Button.LayoutTo(buttonRect), Button.RotateXTo(180));

            bottomSheetState = BottomSheetState.Extended;
        }