简体   繁体   English

如何更改工具栏颜色?(xamarin.forms)

[英]How Change toolbar color?(xamarin.forms)

How Change toolbar color?(xamarin.forms) how change blue to green?如何更改工具栏颜色?(xamarin.forms)如何将蓝色更改为绿色?

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
        xmlns:pages="clr-namespace:News.Pages"
         x:Class="News.MainPage"
        BarBackgroundColor="Green">
<TabbedPage.ToolbarItems>
    <ToolbarItem x:Name="btnSetting" Text="Setting" IconImageSource="Setting.png" Clicked="btnSetting_Clicked"/>
</TabbedPage.ToolbarItems>
<TabbedPage.Children>
    <pages:WorldPage Title="World" IconImageSource="world.png"/>
    <pages:TeredingPage Title="Trending" IconImageSource="trending.png"/>
    <pages:GamePage Title="Game" IconImageSource="xbox.png"/>
</TabbedPage.Children>
</TabbedPage>

screen of app应用程序屏幕

In Android Resource/Layout/Toolbar xaml, there is one property在 Android Resource/Layout/Toolbar xaml 中,有一个属性

android:background="?attr/colorPrimary"

Changing background property like following code:更改背景属性,如以下代码:

<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ff99cc00"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
android:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

在此处输入图像描述

How Change toolbar color?(xamarin.forms) how change blue to green?如何更改工具栏颜色?(xamarin.forms)如何将蓝色变为绿色?

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
        xmlns:pages="clr-namespace:News.Pages"
         x:Class="News.MainPage"
        BarBackgroundColor="Green">
<TabbedPage.ToolbarItems>
    <ToolbarItem x:Name="btnSetting" Text="Setting" IconImageSource="Setting.png" Clicked="btnSetting_Clicked"/>
</TabbedPage.ToolbarItems>
<TabbedPage.Children>
    <pages:WorldPage Title="World" IconImageSource="world.png"/>
    <pages:TeredingPage Title="Trending" IconImageSource="trending.png"/>
    <pages:GamePage Title="Game" IconImageSource="xbox.png"/>
</TabbedPage.Children>
</TabbedPage>

screen of app应用程序屏幕

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

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