在listview之后显示imageview

时间:2011-07-11 10:26:42

标签: android

我想在listview之后添加imageview。在listview中我有这么多的元素。所以我的xml文件是这样的,请看看并帮助我想要在这个xml文件中添加...                                                             - >         

        <LinearLayout
             android:id="@+id/search_layout"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:orientation="horizontal">
            <AutoCompleteTextView android:id="@+id/autocomplete_country"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_marginLeft="5dp"
                android:singleLine="true"
                android:hint="Search"/>
        </LinearLayout>

        <!-- <ScrollView android:id="@+id/scrollView1"
                 android:layout_width="wrap_content" 
                 android:layout_height="match_parent"> -->
        <ListView android:id="@+id/listview"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/search_layout"
            android:layout_centerHorizontal="true" />
        <ImageView android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/orbit"
            android:layout_below="@+id/listview"

            />
         <!-- </ScrollView> -->

    </RelativeLayout>
    <!-- </ScrollView> -->
    <!-- <RelativeLayout android:layout_width="fill_parent"
    android:layout_height="wrap_content"> -->

    <!-- </RelativeLayout> -->
    </LinearLayout>

2 个答案:

答案 0 :(得分:2)

在ImageView中添加属性android:layout_alignParentBottom="true",并将其添加到ListView android:layout_above="@+id/imageViewId"

答案 1 :(得分:1)

除了将ImageView添加为ListView的Footer之外,没有什么对我有用。

最好将ImageView放在单独的布局文件中,然后以编程方式对其进行充气,并将其作为页脚视图添加到列表中。

View footer = getLayoutInflater().inflate(R.layout.footer_image_view, null);
listView.addFooterView(footer);