这是 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"
android:minWidth="25px"
android:minHeight="25px">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/myListView" />
</LinearLayout>`
这是 MainActivity.cs 文件:
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
Glop = new List<string>();
Glop.Add("Tom");
Glop.Add("Dick");
Glop.Add("Harry");
Name = FindViewById<ListView>(Resource.Id.myListView);
}
我正在尝试在 Xamarin Android 中创建一个 Listview。
我已将 android Id 更改为 myListView 并尝试重建该应用程序,但它仍然显示为错误。我现在应该怎么办 ?
原文由 ANSHIT KALAR 发布,翻译遵循 CC BY-SA 4.0 许可协议
再次尝试重建应用程序并保存 main.axml 文件。
构建 > 清理解决方案
构建解决方案