开发者

Android - How to display an ImageView as a header in a listactivity?

开发者 https://www.devze.com 2023-01-04 01:47 出处:网络
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 appreciat

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 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消