Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flyout Icon is not displayed on android. Works fine on Windows. #19178

Closed
tgiacchi opened this issue Dec 3, 2023 · 19 comments · Fixed by #20152
Closed

Flyout Icon is not displayed on android. Works fine on Windows. #19178

tgiacchi opened this issue Dec 3, 2023 · 19 comments · Fixed by #20152

Comments

@tgiacchi
Copy link

tgiacchi commented Dec 3, 2023

Description

When enabling flyouts in shell, the flyout icon (usually the hamburger) does not appear on android. Same problem exists if you switch to a different icon. The same exact code displays properly on windows. See the attached pictures. This happens on the emulator and a real android device (Samsung S22 Ultra). It doesn't matter if the code is built on 17.8.2 or 17.9.1.1
Capture
Capture1

Steps to Reproduce

Start a new maui project. Set the content to this:
`

<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
	<ShellContent
		Title="Page1"
		ContentTemplate="{DataTemplate local:MainPage}"
		Route="Page1" />

	<ShellContent
		Title="Page2"
		ContentTemplate="{DataTemplate local:MainPage}"
		Route="Page2" />
</FlyoutItem>`

Run the code. No flyout icon.

Link to public reproduction project repository

No response

Version with bug

8.0.3

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

API 34

Did you find any workaround?

No.

Relevant log output

No response

@tgiacchi tgiacchi added the t/bug Something isn't working label Dec 3, 2023
@SmartmanApps
Copy link

Works for me on Android, but I don't use shell, so appears to be an issue specific to shell. So one workaround is don't use shell. :-)

@tgiacchi
Copy link
Author

tgiacchi commented Dec 3, 2023 via email

@jfversluis
Copy link
Member

Does it show up when you switch to Dark Theme? Is it maybe just a white icon on a white background?

@jfversluis jfversluis added the s/needs-info Issue needs more info from the author label Dec 4, 2023
@ghost
Copy link

ghost commented Dec 4, 2023

Hi @tgiacchi. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@tgiacchi
Copy link
Author

tgiacchi commented Dec 4, 2023

so, it shows up in dark theme. Still a bug though, the default hamburger as shipped should work either way. However, this may have revealed another issue. My flyout tabs on the bottom show correctly with white icons on black background, but the flyout itself has wrong colors for the icons.
Capture
Capture1PNG

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Dec 4, 2023
@tgiacchi
Copy link
Author

tgiacchi commented Dec 4, 2023

it's possible I am doing something wrong with the SVG files that i use for icons, but not sure why they work in one area and not another. Doesn't make sense that i'd need different SVG images for dark and light mode?

@ertemmstein
Copy link

I have same issue on android

@licon4812
Copy link
Contributor

Check to see if the flyout icon style has thematic colouring or if it is always set to white.

Should be somewhere in Styles.xml

@licon4812
Copy link
Contributor

licon4812 commented Jan 25, 2024

@tgiacchi

if the colour is fixed inside the svg you won't be able to change the colour using maui styles however if you are using a font or UraniumUI. You will be able to change the colour,

@tgiacchi
Copy link
Author

tgiacchi commented Jan 25, 2024 via email

@licon4812
Copy link
Contributor

are you able to send code with icons?

@smlaticc
Copy link

smlaticc commented Feb 1, 2024

For me, problem was in Styles.xaml where different color is only defined for WinUI, and for all other platforms was White color defined.
Before change:
<Setter Property="Shell.ForegroundColor" Value="{OnPlatform WinUI={StaticResource Primary}, Default={StaticResource White}}" />

After change:
<Setter Property="Shell.ForegroundColor" Value="{OnPlatform WinUI={StaticResource Primary}, Default={StaticResource Primary}}" />

And it now works fine for me, since i only use light theme.

@ClintMayers
Copy link

ClintMayers commented Feb 6, 2024

The problem that I am getting is that the image icon for the hamburger is rendered as an alpha channel ONLY for Android output. I tried custom images setting <Shell FlyoutIcon="mycustomimagewithalpha.png" with various versions including SVG, PNG and ICO. For me, all menu image items are rendered correctly. It's just the Hamburger item's color channel is not rendered to let users know there is a hidden flyout menu exists. Yet, this is very important for this tool to be useful as users will see nothing to signify there is a hidden menu to open. I cannot get the so-called Shell.ForegroundColor to affect anything. I even tried to set the RGBA value to #00000000 thinking that maybe it's on a higher level and masking the image. Still nothing. I think it's a bug when translating from MAUI to Android. Will still play on my end, but getting a bit annoyed!

@gjuwindev
Copy link

how comes that nobody from MAUI team doesn't fix this urgently, as well as with the problem of blue text and radio button on black background, which are terrible to read... and all that doesn't sound like a great infrastructure rework...

@JonPetitta
Copy link

For me, problem was in Styles.xaml where different color is only defined for WinUI, and for all other platforms was White color defined. Before change: <Setter Property="Shell.ForegroundColor" Value="{OnPlatform WinUI={StaticResource Primary}, Default={StaticResource White}}" />

After change: <Setter Property="Shell.ForegroundColor" Value="{OnPlatform WinUI={StaticResource Primary}, Default={StaticResource Primary}}" />

And it now works fine for me, since i only use light theme.

This did it for me. Not a good look for the project template to have this issue. Wonder how many people this puts off trying to learn maui.

@ClintMayers
Copy link

While some of you have stated that we can change the color of the Shell.Foreground to make the hamburger appear, this only works if you use the default hamburger by not setting a FlyoutIcon. And in that case, I had to assign Black, not Primary and I could finally see the image. At the very least I could work with that, but I still wanted to assign my own custom color Flyout (hamburger) image.

When I tried to assign a custom FlyoutIcon image, no matter what I tried to do it would always show only as white with alpha. It would not show the RGB colors nor the Shell.Foreground color. The alpha channel does show up as I can see it by changing the background color, or pressing and holding the button.

I am aware that Android uses ARGB format, not RGBA format internally, and wonder if this has something to do with it?

I have even created a custom .xml and with three state images according to Android docs and put in the platform Resources/drawable folder assiging it correctly and get the identical results. I can still just see the alpha with a white color only.

Hopefully, someone is looking into this. Otherwise, I find the Flyout feature has its limits. It would be nice if it could work, though!

@JonPetitta
Copy link

I've done a little digging, Android does not support .svg (I'm guessing), as msbuild converts .svg's to .png's, and you need to reference the image as a .png as that is what will be in the apk. It makes quite a few pngs from the svg, looks like for different display resolution formats. I opened them up and they looked like they should. That said I do see the issue where when trying to set the FlyoutIcon, it is just white, though when using an Image element in xaml the same png is shown properly. I think the ARGB RGBA thing is a bit of a red herring as I believe you are referencing the Java Color class, which is not involved in image loading. The image format specs how the color information should be stored.

I've tried tracking down what file (method) they use for the default hamburger.

@JonPetitta
Copy link

Digging deeper, it looks like whatever you set to FlyoutIcon will be converted to an all white png, and depending on styling, will just be invisible. This happens with either a source png or svg. I have created a bug highlighting this behavior.

20682

@PureWeen PureWeen removed the s/needs-attention Issue has more information and needs another look label Mar 18, 2024
@atkinsonbg
Copy link

For me, problem was in Styles.xaml where different color is only defined for WinUI, and for all other platforms was White color defined. Before change: <Setter Property="Shell.ForegroundColor" Value="{OnPlatform WinUI={StaticResource Primary}, Default={StaticResource White}}" />

After change: <Setter Property="Shell.ForegroundColor" Value="{OnPlatform WinUI={StaticResource Primary}, Default={StaticResource Primary}}" />

And it now works fine for me, since i only use light theme.

Thank you @JonPetitta I was looking for this answer for days! This solved the problem for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Done