【发布时间】:2021-06-11 06:12:48
【问题描述】:
错误: Android.Views.InflateException: 'Binary XML file line #1: Binary XML file line #1: Error inflating class android.support.design.widget.TabLayout'
我添加了新的 TabbedPage,然后在 AppShell.xaml
<ShellContent Title="About" Route="AboutTabbedPage" ContentTemplate="{DataTemplate local:AboutTabbedPage}" />
但是当我在模拟器中点击“关于”时,它抛出错误:
Android.Views.InflateException: 'Binary XML file line #1: Binary XML file line #1: Error inflating class android.support.design.widget.TabLayout'
在任何新的 TabbedPage 上都会引发错误。
TabbedPage的内容如下
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="myapp.Views.AboutTabbedPage"
Title="{Binding Title}"
xmlns:vm="clr-namespace:myapp.ViewModels"
>
<!--Pages can be added as references or inline-->
<ContentPage Title="Tab 2">
<StackLayout>
<Label Text="Green" HorizontalTextAlignment="Center" HorizontalOptions="FillAndExpand" Margin="5" />
<BoxView Color="Green" VerticalOptions="FillAndExpand" />
</StackLayout>
</ContentPage>
</TabbedPage>
android项目中的styles.xml如下:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
【问题讨论】:
标签: c# android xamarin.forms visual-studio-2019 tabbedpage