からListViewコントロールまたはのLinearLayoutにアクセスすることはできません、それは次のようにAXMLのレイアウトを持っています私はちょうどチュートリアル以下のよXamarin.AndroidでResource.Id
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="This app (sort of) was developed (sort of) by its developer (sort of), anything else?"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView1" />
<TextView
android:text="Here is a quick"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView2" />
<Button
android:text="OK Whatever"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/OKWhatever" />
<ListView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/myListView" /> // *TLDR* <====
</LinearLayout>
をしかし、私は、リストビューにアクセスしようとすると、タイピングによって:
listView = FindViewById<ListView>(Resource.Id.myListView);
私が取得する「Resource.Idは私が同じXML内のボタンやテキストビューのような他のタイプのインテリセンスを取得するにもかかわらず、MyListViewをの定義はありません。 LinearLayoutとListViewについては何ですか?もしそうなら、それはチュートリアルでこのように書かれているのですか?
xamarinはxmlレイアウトでエラーを表示していませんか? – CDrosos
いいえ、私はResource.Designer.csが何らかの理由で更新していないと思います。しかし、LinearLayoutは決してアクセスできませんでした。 –
は、Android Resourceに設定されたxmlのビルドアクションですか?これはアクティビティかフラグメントですか? – CDrosos