question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] [Android] Shell.TitleView incorrect positioning of content

See original GitHub issue

Description

Adding a Custom Shell.TitleView to a page results in incorrect positioning of the content. Adding a Shell.TitleView according to the Xamarin.Forms documentation, the image should be displayed horizontally and vertically centered. Instead, it is positioned too far to the right and bottom. A repro is available here

Actual behaviour

image

Expected behaviour

The added image is a menu icon (same as the one for the navigation, just in black). The image should be vertically and horizontally centered in the titlebar.

Steps to Reproduce

  1. Create new Maui project
  2. Add new Xaml-Page
  3. Add Shell.TitleView to the newly created page
  4. Add a Image to the Shell.TitleView and add HorizontalOptions="Center" VerticalOptions="Center"
  5. Replace content of MainPage with a Shell
  6. Add the xml-Namespace xmlns:local="clr-namespace:MauiApp1"
  7. Add FlyoutItem to the Shell with ShellContent ContentTemplate="{DataTemplate local:HomePage}"

Version with bug

Preview 10 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11/API 30

Did you find any workaround?

No response

Relevant log output

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
HausBJBcommented, May 5, 2022

Hello, I have the same problem. Is there a solution for that? it can’t be that you move something like that to NET7

image

They want Maui to start now and the important issues are being postponed

1reaction
myrupcommented, Feb 19, 2023

How is this still an issue almost a year and half later🤔 ? The above is not a working solution if the objective is to center the title text horizontally aligned to the page.

Apart from the above mentioned offset (perhaps created by an unimplemented flyoutmenu?!), back button visibility can also offset the view: Screenshot 2023-02-19 at 22 34 06 Screenshot 2023-02-19 at 22 33 51

So if we were to center the title to the page using Shell.TitleView (as far as I can tell) not only would we have to offset the error-looking leftside offset but also according to whether or not the back button is visible.

Our current workaround is to disable Shell.TitleView and re-implement backbutton behaviour 😏

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug] [Android] Shell.TitleView incorrect positioning of content
NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop. - [Bug] [Android] ......
Read more >
Xamarin Forms Shell TitleView does not center image
You can see that the content of Title View , And the icon already been center in Title View .Because of existing meun...
Read more >
Every other tab in Shell doesn't show Shell.TitleView on ...
Hello, I have a pure MAUI app which targets only Android. This are the contents my Shell.xaml file:
Read more >
Xamarin.Forms 5.0.0.2244 (5.0.0 Service Release 7) ...
Title on iOS, but fine on Android." (#13319); GitHub #13310 - "[Bug] Shell.TitleView no longer displays a title view on a ContentPage ...
Read more >
Maui navigation and TitleView is very confusing
I am trying to customize the TitleView in a Maui app. 1st - I am trying to get the page title but this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found