De la ressource.Id ne fonctionne pas dans Xamarin

C'est le principal.axml fichier.

`<?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>`

Et c'est le MainActivity.cs fichier :

protected override void OnCreate(Bundle bundle)
{
de la 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);

}

Je suis en train de créer une Listview dans Xamarin Android.

J'ai changé le android Id pour myListView et ont également essayé de reconstruire l'application, mais il apparaît toujours comme une erreur . Que dois-je faire maintenant ?

Nettoyer et Reconstruire votre projet. Il faut ensuite régénérer la Resources.designer.cs fichier qui doit inclure votre nouveau Id définition.

OriginalL'auteur ANSHIT KALAR | 2016-03-30