我是Xamarin中的新手。我安装了Nuget Package Manager的Android.support.v7.App库,并成功地构建了项目。现在,当我扩大应用程序而不是活动时,我得到了例外: -
Android.Content.Res.Resources+NotFoundException: Resource ID #0x7f030015
我的活动代码如下: -
using Android.App;
using Android.Widget;
using Android.OS;
using Android.Content;
using Android.Preferences;
using Android.Support.V7.App;
namespace ExampleDemo
{
[Activity(Label = "ExampleDemo", Icon = "@drawable/icon")]
public class MainActivity : AppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
}
}
}
和我的axml文件包含以下代码: -
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/MyButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Hello"
android:layout_marginTop="50dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" />
</LinearLayout>
有人可以告诉我我做错了什么?
预先感谢。
您是否尝试过清洁解决方案?Xamarin可以卡在解析XML的地方。