Hi,

I tried to make a post about this before but I don't see it in the
group for some reason. :/

I am trying to make a list of books, with each book containing two
lines of text and a delete button.  For some reason when I add books
to the adapter they show up in the list twice.  What am I doing
wrong?  How can I correct it?

Here is my layout:


<?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="wrap_content"
    android:layout_height="wrap_content"
    android:text="Shopping Cart" />

    <ListView
    android:id="@+id/BookList"
    android:layout_width="fill_parent"
    android:layout_height="300px">
    </ListView>

    <Button
        android:text="Add Another Book"
        android:id="@+id/AddAnother"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
    </Button>

    <Button
        android:text="Checkout"
        android:id="@+id/Checkout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
    </Button>

</LinearLayout>


Here is the XML for the line item:


<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="?android:attr/listPreferredItemHeight"
    android:padding="8dip">

        <LinearLayout
        android:orientation="vertical"
        android:layout_width="0dip"
        android:layout_weight="1"
        android:layout_height="wrap_content">

        <TextView
        android:id="@+id/BookTitle"
    android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:singleLine="true"
    android:gravity="center_vertical"
    />

        <TextView
        android:id="@+id/BookPrice"
    android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:singleLine="true"
    android:ellipsize="marquee"
    />
    </LinearLayout>

    <Button
    android:id="@+id/buttonLine"
    android:gravity="center"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_alignParentRight="true"
    android:text="Delete"
    />


Thanks,
gb

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to