Comment utiliser addHeaderView pour ajouter un simple ImageView à un ListView

Mon objectif est simple. Je veux ajouter un "Rectangle Rouge" comme un headerview à un ListView.
j'ai donc créer une activité simple

public class MainActivity extends Activity {
    private String[] adapterData = new String[] { "Afghanistan", "Albania", "Algeria", 
            "American Samoa", "Andorra", "Angola"}; 

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ListView lv;
        lv = (ListView)findViewById(R.id.list);

        LayoutInflater lf;
        View headerView;
        lf = this.getLayoutInflater();
        headerView = (View)lf.inflate(R.layout.header, null, false);

        lv.addHeaderView(headerView, null, false);

        lv.setAdapter(new ArrayAdapter<String>(this, R.layout.list_item, adapterData)); 
    }
}

activity_main.xml

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FF0" 
        android:cacheColorHint="#0000"
        android:paddingLeft="20dip"
        android:paddingRight="20dip"
        android:divider="#0000"
        android:scrollbarStyle="outsideOverlay" />

list_item.xml

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    android:layout_width="match_parent"
    android:layout_height="0dip"
    android:minHeight="40dip"
    android:singleLine="true"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:gravity="center_vertical"
/>

plus important, header.xml

<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="100dip"
    android:background="#F00"/>

Mais il ne semble pas fonctionner. Rien n'est affiché.

Peut donner quelques suggestions à ce sujet? Votre aide est très appréciée.

source d'informationauteur user1764413