Melody Horn
Melody Horn

Reputation: 768

XML layout not cooperating

I'm having trouble trying to use a list in my activity. My XML for res/layout/main.xml is as follows:

<?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"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />
<ListView android:id="@+id/ListView01" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TwoLineListItem android:id="@+id/TwoLineListItem01" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:id="@android:id/text1"
        android:layout_marginTop="1dip"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="15sp"
        android:textStyle="bold"
        android:text="@string/text1" />
<TextView android:id="@android:id/text2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@android:id/text1"
        android:layout_alignLeft="@android:id/text1"
        android:paddingBottom="4dip"
        android:includeFontPadding="false"
        android:textSize="15sp"
        android:textStyle="normal"
        android:text="@string/text2" />
</TwoLineListItem>
</ListView>
</LinearLayout>

Once I try to run it, however, my app just "quits unexpectedly". It's got to be something wrong with the XML, since the activity is just the default setContentView(R.layout.main); Please tell me what I'm doing wrong.

Upvotes: 1

Views: 135

Answers (1)

Macarse
Macarse

Reputation: 93183

TwoLineListItem looks wrongly used.

Check this tutorial.

Upvotes: 2

Related Questions