You must specify the android:src
attribute for the ImageView
:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imgTab"
android:src="@drawable/img"/>
With no content (src), its size will be 0x0 (due to wrap_content
).
Specifying the indicator (header) of a tab view is made from java code, usually chained:
myTabHost.newTabSpec(tag).setIndicator(myTab).setContent(intent);
where myTabHost
is your TabHost
instance, and myTab
is a View
instance that will be used as the header of this tab.
You can create your own tab: define its layout in xml and add all the views (image, text...) you need on it.
For reference (complete sample) see the update part of this answer.
The layout/tab.xml
file contains the layout of the tab headers (including an icon too).