Search code examples
androidxmllayoutandroid-arrayadaptercustom-lists

Custom List Adapter Wont display pictures


Edit: I removed my exception information. With the Help of @Sam I was able to use fix project properties and the application no longer force closes on me. Though, rearranging the layout from image textview to textview image causes it to not display images. Does anyone have any idea why? All code can be found here http://www.ezzylearning.com/tutorial.aspx?tid=1763429

I am attempting to follow this tutorial http://www.ezzylearning.com/tutorial.aspx?tid=1763429 I have everything working as posted. I am adopting this for a more complex layout. I tried to change something very simple. I moved the image from the left to the right.

BEFORE

<ImageView android:id="@+id/imgIcon"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:gravity="center_vertical"
    android:layout_alignParentTop="true"
    android:layout_alignParentBottom="true"
    android:layout_marginRight="15dp"
    android:layout_marginTop="5dp"
    android:layout_marginBottom="5dp" />

 <TextView android:id="@+id/txtTitle"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center_vertical"
    android:layout_alignParentTop="true"
    android:layout_alignParentBottom="true"
    android:textStyle="bold"
    android:textSize="22dp"
    android:textColor="#000000"
    android:layout_marginTop="5dp"
    android:layout_marginBottom="5dp" />

AFTER

       <TextView android:id="@+id/txtTitle"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center_vertical"
        android:layout_alignParentTop="true"
        android:layout_alignParentBottom="true"
        android:textStyle="bold"
        android:textSize="22dp"
        android:textColor="#000000"
        android:layout_marginTop="5dp"
        android:layout_marginBottom="5dp" />

     <ImageView android:id="@+id/imgIcon"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:gravity="center_vertical"
        android:layout_alignParentTop="true"
        android:layout_alignParentBottom="true"
        android:layout_marginRight="15dp"
        android:layout_marginTop="5dp"
        android:layout_marginBottom="5dp" />

Solution

  • This makes no sense!

    • Try cleaning your project: Project -> Clean...
    • Or use Fix Properties from Android Tools

    Also your ImageView and TextView are sitting on top of each other, you might want to add android:layout_width="wrap_content" and android:layout_weight="5" to the TextView and android:layout_weight="1" to the ImageView. ... :)