Binary XML file line #1: Error inflating class listView

MannyDiaz.0096MannyDiaz.0096 USMember
edited May 2014 in Xamarin.Android

Hello,

I'm a newbie. I cant get the list to work below some buttons. Here is my code.

using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace TestLayout
{
[Activity (Label = "Test", MainLauncher = true)]
public class MainActivity : Activity
{

    protected override void OnCreate (Bundle bundle)
    {
        base.OnCreate (bundle);

        // Set our view from the "main" layout resource
        SetContentView (Resource.Layout.Main);

        // Get our button from the layout resource,
        // and attach an event to it
        TextView TopTextbox = FindViewById<TextView> (Resource.Id.toplabel);
        ListView serverListView = FindViewById<ListView> (Resource.Id.List);
        Button NewButton = FindViewById<Button> (Resource.Id.New);
        Button EditButton = FindViewById<Button> (Resource.Id.Edit);
        Button ConnectButton = FindViewById<Button> (Resource.Id.Connect);


    }
}

}

Best Answer

Answers

  • MannyDiaz.0096MannyDiaz.0096 USMember

    <?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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"> <TextView android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:id="@+id/toplabel" /> <Button android:id="@+id/New" android:text="New" android:layout_width="100.0dp" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_toLeftOf="@+id/Edit" android:layout_alignTop="@+id/Edit" /> <Button android:id="@+id/Edit" android:text="Edit" android:layout_width="100.0dp" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_below="@+id/toplabel" /> <Button android:id="@+id/Connect" android:text="Connect" android:layout_width="100.0dp" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_toRightOf="@+id/Edit" android:layout_alignTop="@+id/Edit" /> <TextView android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_below="@+id/Edit" android:id="@+id/labeltwo" /> <listView android:id="@+id/List" android:layout_below="@+id/labeltwo" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fitsSystemWindows="true" style="@android:style/Widget.ListView" /> </RelativeLayout>

  • JasonAwbreyJasonAwbrey USInsider, University, Developer Group Leader mod

    There is an Android specific forum for asking Android questions

Sign In or Register to comment.