I'm developing a small Xamarin App.I am having trouble with this error on Xamarin for VS. I've tried to recreate this in a different project. I have already tried this solution Your content must have a ListView whose id attribute is 'android.R.id.list', its all over the Internet - and I'm starting to think its only applicable to Android Java Applications. When I change the id to android:id="@android:id/list i get the following error: Severity Code Description Project File Line Suppression State Error CS0117 'Resource.Id' does not contain a definition for 'list'
Android documentation wasn't very helpful either - https://developer.android.com/reference/android/app/ListActivity.html. I'm fairly new to Android and Xamarin Dev.
Here's my AXML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myDrawer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/txText"
android:text="Hey slide from left of right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</FrameLayout>
<ListView
android:id="@+id/leftListView"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:choiceMode="singleChoice"
android:divider="#D2D2D2"
android:dividerHeight="24dp"
android:background="#F2F2F2" />
</android.support.v4.widget.DrawerLayout>
Here's my cs file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Support.V4.Widget;
public class WelcomeActivity : ListActivity
{
DrawerLayout mDrawerLayout;
List<string> menuItemsLeft = new List<string>();
ArrayAdapter mLeftAdapter;
ListView mLeftDrawer;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Create your application here
SetContentView(Resource.Layout.Generics);
mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.myDrawer);
mLeftDrawer = FindViewById<ListView>(Resource.Id.list);
}
Thank you in advance