xamarin/Xamarin.Forms

[Bug] TitleView behavior inconsistent between Android and iOS

Open

#6,522 opened on Jun 13, 2019

 (0 comments) (0 reactions) (0 assignees)C# (1,926 forks)batch import
a/titleviewe/4 :clock4:help wantedinactivep/Androidp/iOS 🍎t/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

Created a TitleView that contains an image set to Aspect.Fit. The image is resized in Android, but not in iOS. In iOS the image is cut off.

Added padding and margin on the TitleView. Android didn't change, Added a ToolbarItem. The TitleView on Android resized so the full image displayed in the reduced space. On iOS the image is not resized, it is cut off.

Changed the TitleView to add a second image, a label, and a background color. Android did not change at all. iOS did display the changes, at least as many would fit on the screen, as the image was still cut off.

Changed the initial image to add a width request. iOS displayed the image in a smaller size, Android did not

Steps to Reproduce

  1. Run the attached test app on Android and iOS. Android: image

iOS:
image

  1. in TitleView.cs, uncomment the Margin and Padding lines (32 & 33) Android: image iOS: image

  2. In the same file, uncomment the two Background Color lines (14 & 34) Android: image iOS: image

  3. In TargetedMessagePage.xaml.cs, uncomment the ToolbarItems line (23) Android: image iOS: image

  4. In TitleView.CS, comment out the Children declaration with one item (28) and uncomment the one with three (29) Android: image iOS: image

6: In TItleView.cs, uncomment the WidthRequest line (15) Android: image iOS: image

Expected Behavior

The TitleView should properly reflect the changes in both environments.

Actual Behavior

See above

Basic Information

  • Version with issue: 4.1.0 pre2
  • Last known good version:
  • IDE:
  • Platform Target Frameworks:
    • iOS:
    • Android:
    • UWP:
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Screenshots

see above

Reproduction Link

HeaderTest.zip

Contributor guide