user1735986
user1735986

Reputation: 67

add image in listview with tabhost

This is the .xml of the MainActivity, It's composed by two tabhost, the first contain a dynamic listview. I want to add in the beginning of every item of listview an image like an icon or logo.

What are modifications of the .xml that i must do. thx

this is 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>

Upvotes: 0

Views: 346

Answers (2)

Adrian C.
Adrian C.

Reputation: 1687

You can find a tutorial of using Custom ArrayAdapter with ListView: http://www.ezzylearning.com/tutorial.aspx?tid=1763429.
Here is another tutorial http://www.vogella.com/articles/AndroidListView/article.html.

Hope this helps.

Upvotes: 1

Emil Davtyan
Emil Davtyan

Reputation: 14089

You need to set up an adapter for your ListView and then in the getView of the adapter inflate or programmatically create a group of views that represents each individual item in the ListView.

You should google tutorials about how to set up adapters for ListViews

Upvotes: 0

Related Questions