Android - How to display an ImageView as a header in a listactivity?
I'm trying to display an image before the list in a listactivity.
If I put an ImageView before the ListView, then only the list is displayed... still quite an android n00b so any pointers appreciated :)
Heres my main.xml which lays out the list activity:
<?xml version="1.0" encoding="utf-8"?>
<Line开发者_如何学编程arLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView android:id="@+id/header"
android:src="@drawable/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:scaleType="fitStart"
/>
<ListView android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="fitEnd"
/>
</LinearLayout>
OK... I was missing android:orientation="vertical"
It seems to work now :)
精彩评论