Reputation: 806
Im using Xamarin Forms and i want to change color of Navigationbar in Android. Im using this code:
MainPage = new NavigationPage
{
BarBackgroundColor = Color.Lime,
BarTextColor = Color.Purple
};
The first property (BarBackgroundColor
) was worked, second property not worked (BarTextColor
).
Please kindly answer me.
Upvotes: 5
Views: 7370
Reputation: 1
Setting those attributes in app.xaml only will reliably do the job!
Upvotes: 0
Reputation: 43
var page = new navigationPage(new yourPage());
page.BarBackgroundColor = Color.FromHex("#123456");
It will change yourPage()
bar color
Upvotes: -1
Reputation: 6921
you can set in your app.xaml and it will override it
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="Red"/>
<Setter Property="BarTextColor" Value="White"/>
</Style>
</ResourceDictionary>
Upvotes: 3
Reputation: 7594
If you are trying to set the text color on Android 5.0 or higher, you need to set the Theme
of the MainActivity
. Here is a simple one that should work...
[Activity(
Label = "Some App Title",
Icon = "@drawable/icon",
MainLauncher = true,
Theme = "@style/android:Theme.Holo.Light"
)]
Upvotes: 1