0

这是MainActivity的.xml,它由两个tabhost组成,第一个包含一个动态列表视图。我想在列表视图的每个项目的开头添加一个图像,如图标或徽标。

我必须对 .xml 进行哪些修改。谢谢

这是 main.xml

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@android:id/tabhost"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent">
    <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp">

        <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"/>

        <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:padding="5dp"/>

    </LinearLayout>
</TabHost>
4

2 回答 2

1

您可以找到将自定义 ArrayAdapter 与 ListView 一起使用的教程:http ://www.ezzylearning.com/tutorial.aspx?tid=1763429 。
这是另一个教程http://www.vogella.com/articles/AndroidListView/article.html

希望这可以帮助。

于 2012-11-01T16:39:41.603 回答
0

您需要为您的适配器设置一个适配器ListView,然后在getView适配器中膨胀或以编程方式创建一组视图,这些视图代表ListView.

你应该谷歌ListView关于如何为s设置适配器的教程

于 2012-11-01T16:35:41.553 回答