Xamarin.Android属性显示"未声明"

时间:2017-04-27 18:03:58

标签: android xml mobile xamarin

我是Xamarin的新手,尤其是xml,但我遇到了一个问题,经过数小时的搜索,我无法用任何解决方案解决这个问题。我正在尝试使用" android.support.percent"包以在相对布局上使用百分比边距。我已经安装了适当的NuGet包来支持它。它工作了一段时间,但现在它突然开始在整个文件中给我多个警告和消息。

第一个错误只是"' PercentRelativeLayout'属性未声明。"这只是我的起始xml标记的名称。这是代码:

<?xml version="1.0" encoding="utf-8"?>
<PercentRelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/percentRelativeLayout"
    android:background="#000000">

其次,AndroidManifest中会出现四条警告,其中包含类似的消息:&#34;&#39; http://schemas.android.com/apk/res/android:xxxx&#39;属性未声明。&#34;其中&#39; xxxx&#39;是versionCode,versionName,label和icon。清单文件根本不是很广泛:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="MyProject.MyProject" android:versionCode="1" 
    android:versionName="1.0">
    <uses-sdk />
    <application android:label="MyProject" 
    android:icon="@drawable/Icon"></application>
</manifest>

除此之外,有4条消息显示说:
&#34;无法找到元素的架构信息&#39; manifest&#39;。&#34;
&#34;无法找到属性&#39;包的架构信息。&#39;。&#34;
&#34;无法找到属性的架构信息&#39; uses-sdk&#39;。&#34;。&#34;
&#34;无法找到元素&#39;应用程序的架构信息。&#39;。&#34;

这是什么意思,我怎样才能回到实际开发这个应用程序?

2 个答案:

答案 0 :(得分:-1)

自己搞清楚,我对此并不擅长。标签必须是。

清单错误,我不知道,但他们似乎解决了自己。

答案 1 :(得分:-1)

定义是:

<android.support.percent.PercentRelativeLayout>

您需要在此布局中包含正确的包名称,否则将无法找到它。

至于AndroidManifest.xml这看起来很好看。