简体   繁体   English

Xamarin Forms Shell 是否可以删除导航栏但保留汉堡包图标?

[英]Xamarin Forms Shell is there anyway to remove the navigation bar but keep the hamburger icon?

Is there anyway to allow content to touch the top of the screen while keeping the hamburger icon.无论如何,是否允许内容在保留汉堡包图标的同时触摸屏幕顶部。 In the example below, imagine the blue background was an image, I want the blue to touch the top of the screen and have the hamburger icon overlay over the top:在下面的示例中,假设蓝色背景是一个图像,我希望蓝色接触屏幕顶部并将汉堡包图标覆盖在顶部: 示例 1

I've tried the following but it just changes the colour of the bar:我已经尝试了以下但它只是改变了酒吧的颜色:

<Shell 
       BackgroundColor="Transparent">

If there is no way to hide just the bar, is there anyway to hide the bar and the hamburger icon and then add the icon back manually?如果没有办法只隐藏栏,是否有办法隐藏栏和汉堡包图标,然后手动添加图标?

EDIT: I tried but it removed the hamburger icon as well.编辑:我尝试过,但它也删除了汉堡包图标。 Is there anyway to add the hamburger icon back?:无论如何要添加汉堡包图标?:

Shell.NavBarIsVisible="False"

EDIT: Just seen this implentation which is what I need but is there anyway to do this with Xamarin Shell: https://xamgirl.com/transparent-navigation-bar-in-xamarin-forms/编辑:刚刚看到了我需要的这个实现,但无论如何都可以用 Xamarin Shell 做到这一点: https ://xamgirl.com/transparent-navigation-bar-in-xamarin-forms/

RESOLUTION: This has now been moved to the Xamarin Forms GitHub解决方案:现已移至Xamarin Forms GitHub

Set the style of Shell navigation bar in Resource Dictionary资源字典中设置Shell导航栏的样式

   <Shell.Resources>
        <ResourceDictionary>
            <Color x:Key="NavigationPrimary">#2196F3</Color>
            <Style x:Key="BaseStyle" TargetType="Element">
                <Setter Property="Shell.BackgroundColor" Value="Transparent" />  // set navigation bar as Transparent
                <Setter Property="Shell.ForegroundColor" Value="Blue" />
                <Setter Property="Shell.TitleColor" Value="Blue" />
                <Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
                <Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
                <Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
                <Setter Property="Shell.TabBarForegroundColor" Value="White"/>
                <Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/>
                <Setter Property="Shell.TabBarTitleColor" Value="White"/>
            </Style>
            <Style TargetType="TabBar" BasedOn="{StaticResource BaseStyle}" />
        </ResourceDictionary>
    </Shell.Resources>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM