xamarin forms - actionbar color

randy

How do I change the color of the actionbar and get the horizontal line back?

I have a successful android app developed in native xamarin android. Now i'm trying to port it to Xamarin Forms using the xaml approach.

I've created a hello world app and added a toolbar item the contentPage. When I initially start the app, the action bar is visible with my icon, the normal teal background and there is a nice horizontal line. However, once my forms code kicks in, it displays my icon, my toolbaritem icon, but the background is black and there is no horizontal line.

I've tried NavigationPage.BackgroundColor and that had no affect. I'm thinking i'm doing something small wrong.

Here is my xaml.

<?xml version="1.0" encoding="utf-8" ?> 
<ContentPage.Title> My Sample </ContentPage.Title>

 <ContentPage.ToolbarItems>
        <ToolbarItem Name="test" Icon="ic_action_refresh" ></ToolbarItem>
  </ContentPage.ToolbarItems>


<Label Text="Hello Forms" VerticalOptions="Center" HorizontalOptions="Center" />

</ContentPage>

Here is my app.cs

public class App 
{ 
public static Page GetMainPage() 
{ 
     var nav = new NavigationPage(new Splash()); 
     nav.BackgroundColor = Color.Teal; 
     return nav; 
} 
}

I'd also like to hide the default actionbar at startup and go with a full splash screen, but I did find this thread that looks like it'll work. http://forums.xamarin.com/discussion/18290/hiding-the-status-bar-and-the-action-bar-in-android-app

randy

I figured it out. I was using the default template in VS2013 and the Xamarin.Forms.Core library reference was version 1.0. There have been a few updates since and one of them fixed the issue. I just updated via nuget to the latest version and it started working.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

ActionBar color change also ListView color

분류에서Dev

Xamarin Forms Switch XAML

분류에서Dev

Xamarin Forms Reverse PushModalAsync

분류에서Dev

Xamarin Forms 영역

분류에서Dev

Xamarin Forms DependencyService nullReferenceException

분류에서Dev

Xamarin Forms EventToCommandBehavior

분류에서Dev

Xamarin Forms TemplateSelector for View

분류에서Dev

Xamarin 양식 : Xamarin.Forms.Color를 반환하는 함수의 비정상적인 동작

분류에서Dev

Xamarin.Forms없이 Xamarin BeginInvokeOnMainThread

분류에서Dev

Windows forms : color dialog solid color only

분류에서Dev

Xamarin.Forms Accessibilty VoiceReader

분류에서Dev

Use RadioButton in Xamarin.Forms

분류에서Dev

Customizing Xamarin.Forms layouts

분류에서Dev

Xamarin Forms: ContentPage OnCreate event?

분류에서Dev

Xamarin.Forms 맵 핀

분류에서Dev

Xamarin.Forms (공유)

분류에서Dev

Xamarin Forms : Toasts.Forms.Plugin 오류

분류에서Dev

Onlaunched의 Xamarin.Forms.Forms.Init (e) FileNotFoundExeception

분류에서Dev

Xamarin Forms Remove space from Entry

분류에서Dev

Xamarin.Forms 선택기

분류에서Dev

Xamarin Forms Bind List <myObject> to Picker

분류에서Dev

Xamarin Forms Transalted 단추 클릭

분류에서Dev

Xamarin Forms iOS Renderer for Facebook Audience Network

분류에서Dev

How to use message pack in xamarin forms

분류에서Dev

Xamarin Forms Artnet 및 UDP 전송

분류에서Dev

Xamarin Forms, XAML의 동적 ScrollView

분류에서Dev

Xamarin.Forms-DatePicker 복제

분류에서Dev

How to access a field in a database table in Xamarin Forms

분류에서Dev

Xamarin Forms Maps Google 전용?