Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Error: "Binary XML file line #1: You must supply a layout_width attribute" [SOLVED]

$
0
0

I am trying to link my EntryView : ListActivity to my EntryView layout, but when I navigate to the EntryView activity I get the above error. I saw a similar issue here, but the user never posted the solution. Upon some googling, all I got was that I should make sure that my xmlns pointed to http://schemas.android.com/apk/res/android, which I have already confirmed. Furthermore, the Main.axml (Which relates to MainActivity : Activity) has the same LinearLayout declaration as the EntryView.axml and works fine.

Here is my code for my EntryView ListActivity (minus the using directories):

namespace DataInteraction
{
[Activity (Label = "EntryView")]            
public class EntryView : ListActivity
{
    public string token;
    public string email;
    public string name;
    protected override void OnCreate (Bundle bundle)
    {
        string[] items;
        base.OnCreate (bundle);
        SetContentView (Resource.Layout.EntryView);


        string holder = Intent.GetStringExtra ("Token"); 
        string[] temp = holder.Split ('|');
        token = temp [0];
        name = temp [1];
        email = temp [2];
        TextView lblWelcome = FindViewById<TextView> (Resource.Id.lblWelcomeMsg);
        lblWelcome.Text = "Welcome " + name + "!";


        items = new string[] { "Test 1", "Test2", "Test 3" };
        ListAdapter = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleListItem1, items);
        // Create your application here
    }

}

}

And for EntryView.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/>

    <TextView
        android:text="Welcome!"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/lblWelcomeMsg" />
    <ListView
        android:id="@+id/lstEntries"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:cacheColorHint="#FFDAFF7F" />
</LinearLayout>

Viewing all articles
Browse latest Browse all 204402

Trending Articles