Har en vanlig Activity (min sdk version 7, target sdk version 15).
Använder mig av en Listview och en TabHost, båda deklarerade i xml-filen för aktiviteten. Har skrivit en egen Adapter som jag använder till min ListView.
Om jag har min Listview direkt i layouten, det vill säga inte i någon flik, fungerar den perfekt. Men om jag placerar den i någon flik syns den inte alls.
Andra komponenter i samma flik syns och fungerar som de ska. Vad beror detta på? Måste jag göra något speciellt med min ListView eller måste jag uppdatera TabHosten på något vis när innehållet uppdaterats?
Detta är min XML-fil:
HTML:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!--
EN LISTVIEW HÄR FUNGERAR PERFEKT
-->
<TabHost
android:id="@+id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/tformulas"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/tformulas_clear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Börja om"
android:visibility="invisible"/>
<!--
DETTA ÄR MIN LISTVIEW. DEN VÄGRAR FUNGERA HÄR.
-->
<ListView
android:id="@+id/tformulas_list"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
</LinearLayout>
<LinearLayout
android:id="@+id/tfavorites"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- More stuff -->
</LinearLayout>
<LinearLayout
android:id="@+id/trecent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/trecent_clear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Rensa"/>
<!-- More stuff -->
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</RelativeLayout>