私はC#での経験はありますが、XamarinとXMLについてはかなり新しいです。私は、XMLでのタブ付きページを作成して、それがすべてMain.axmlで表示されていない:タブ付きページとコンテンツページが表示されない
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mypages="clr-namespace:MainActivity.Pages;assembly=MainActivity"
x:Class="MainActivity.tabPages">
<TabbedPage.Children>
<mypages:Home />
<mypages:AddLocation />
</TabbedPage.Children>
</TabbedPage>
私は2人のtabbedpageの子供持っている(ホームと場所を追加します。)私はホーム・ページになりたいですタブページは表示されず、アプリケーションは空白ですが、デフォルトのページです。
Home.axml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MainActivity.ActualPage" Title="Home" BackgroundColor="Green">
<ContentPage.Content>
<Label Text="Hi there from Page 1" TextColor="White" Font="20"
VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage.Content>
</ContentPage>
MainActivity.cs:
using Android.App;
using Android.Widget;
using Android.OS;
namespace Xonify
{
[Activity(Label = "App", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView (Resource.Layout.Main);
}
}
}
おかげで、
マット
完全なコードを投稿してください – Pehlaj
'Main.xaml'(not axml)を' App.xaml.cs'の 'MainPage'として設定していますか? –
SetContentView(Resource.Layout.Main)を追加しました。エラーをスローしていますが、エラーがスローされているようです。TabbedPage – user7834940