【发布时间】:2018-04-18 15:10:24
【问题描述】:
在 Xamarin Android 中,当我从 Activity 调用 axml 文件时,出现以下错误,
“未处理的异常:
Android.Views.InflateException:二进制 XML 文件第 1 行:二进制 XML 文件第 1 行:膨胀类错误 android.support.design.widget.BottomNavigationView 发生”
我在这里停留了 2 天,我没有得到错误的原因。请帮帮我。
我在这一行遇到错误,
SetContentView(Resource.Layout.main_page);
我的 axml 文件是,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottom_navigation" />
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_alignParentBottom="true"
android:background="@android:color/white"
app:elevation="16dp"
app:menu="@menu/bottom_navigation_main"/>
</RelativeLayout>
提前致谢。
【问题讨论】:
-
确保您在项目中配置了 com.android.support:design 库。
-
是的..它已配置
-
试试这个 从 gradle 中删除
com.android.support:design。清理项目再次添加com.android.support:design并重新同步。 -
我试过了..我遇到了同样的问题..
-
你能发布你的应用 build.gradle 吗?
标签: android xamarin xamarin.android