-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[F100] Translucent Nav Bar #1698
Comments
@rmarinho It would appear that is only for iOS? This may be because on Android a translucent status bar is ordinarily done through themes which will be challenging to achieve with Xamarin Forms.... |
I was searching for an Android implementation of a translucent NavigationPage toolbar and found this PR: #1287 It seems to handle the Android side of things. Looking forward to having this in Xamarin.Forms 3.0 :-) |
@bentmar I would like to implement the same effect on android as you showed in your post, do you have any source code for this? (if you are willing to share ofcourse) |
@bentmar |
@jelle-vdst do you mind to share? I haven't found it yet. |
@5yunus2efendi I've made a custom navigationPage adding a Translucent (bool) property and a translucent change event then i've made a custom navigation renderer and overridden the OnLayout like this: `protected override void OnLayout(bool changed, int l, int t, int r, int b)
I've also added this: ` public NavigationPageExRenderercs(Context context) : base(context)
The ActionBarHeight and GetToolBar method i've copied out of the xamarin forms renderer (based all my code on what happens in the standard renderer). The code still needs to be optimized (for example switching from a page with translucent to a page without is not smooth yet, it's still a work in progress) |
@jelle-vdst It works!, thanks. |
@jelle-vdst I wouldn't write such custom code to create a translucent navigation bar as it is likely that it will be interfering with how XF is laying out controls (now or in the future). Xamarin should support this functionality out of the box. @bentmar With regards to A more complicated scenario should be supported by XF. Suppose one page set @rmarinho If I'm not mistaken, iOS transcluency does not get rid of the navbar as in the case of @bentmar's DrawBehind gif even if |
@adrianknight89 I agree, but I need the functionality right now, the moment it's supported, I'll kick out my custom renderer. But right now I need it, I only need the transparency on one page and it works smootly for the moment. |
@jelle-vdst Can you share me your navigationbar renderer make for this ? |
@jelle-vdst I thought that the translucent navbar was already available with XF3, as we can see this in the ConferenceVision Xamarin sample. But they used a similar approach to yours. Do we know when this feature will be officially supported? And would you have a Github project that describes your implementation? |
I've implemented the solution found in the ConferenceVision sample, but I meet a strange behavior that I describe there: the rendering is not the same between iOS 10.1 and iOS 11.3. If you have any suggestion, you're welcome! |
Guys, |
Any news on this one? |
I think some of this is now possible? There won't be any work done on this for Xamarin.Forms though. If this is something people are still interested in, please open an feature request on the .NET MAUI repo. Thanks for you interest and input everyone! |
Rationale
Currently when setting the navigation bar to Translucent requires a custom renderer. In addition the Xamarin Forms content pages don't account for the extra space now created by the translucent bar. Having a property on the NavigationBar to allow it to be transparent and then having the content flow correctly would be useful
Implementation
Navigation Renderer will set the Nav Bar to be translucent and then the contained pages will fill all available space
Expected Result
Android
NavigationPage.IsTranslucent = true
: Should cause the navigation bar to become translucent. Content Pages should shifted and measured as if the Navigation Bar doesn't existiOS
See Android
UWP
See Android
Implications for CSS
Not sure if this translates to the same concept as making the navbar translucent as "translucents" also has content flow implications. Could possibly map opacity >= 0.5 to setting the IsTranslucent Property to true
Backward Compatibility
Third party renderers may need to be updated to ensure that this functionality is supported through the new official mechanism. Further we will need to be careful to code the changes to the renderers in a careful manner to ensure that if someone is already using an effect support this feature that the effect is as best as possible not broken by our changes.
Difficulty : Medium
https://bugzilla.xamarin.com/show_bug.cgi?id=24500
The text was updated successfully, but these errors were encountered: