TabHost-Problem

  • Antworten:4
superSharp
  • Forum-Beiträge: 89

17.11.2013, 15:03:20 via Website

Hi,

ich hab ein Problem mit dem TabHost-Element. In allen Beispielen (http://www.androidhive.info/2011/08/android-tab-layout-tutorial/) die ich bis jetzt gefunden hab, wird in der main-Activity der TabHost so aufgerufen:

1TabHost tabHost = getTabHost();

Ich hab exakt das gleiche XML verwendet und trotzdem gibt es die Funktion bei mir nicht?

XML:

1<?xml version="1.0" encoding="utf-8"?>
2<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
3 android:id="@android:id/tabhost"
4 android:layout_width="fill_parent"
5 android:layout_height="fill_parent">
6 <LinearLayout
7 android:orientation="vertical"
8 android:layout_width="fill_parent"
9 android:layout_height="fill_parent">
10 <TabWidget
11 android:id="@android:id/tabs"
12 android:layout_width="fill_parent"
13 android:layout_height="wrap_content" />
14 <FrameLayout
15 android:id="@android:id/tabcontent"
16 android:layout_width="fill_parent"
17 android:layout_height="fill_parent"/>
18 </LinearLayout>
19</TabHost>


1R.id.tabHost
gibts bei mir nicht :(

— geändert am 17.11.2013, 15:03:59

Antworten
Fabian
  • Forum-Beiträge: 144

17.11.2013, 17:25:02 via Website

Sollte das nicht klappen, schraub deine Android Version mal hoch.
Habe das Thema vor kurzem auch abgearbeitet und irgendwann nach ner "kleinen" Spielerei, hat es dann geklappt.

grüße Fabian!

Antworten
SvenDD
  • Forum-Beiträge: 272

17.11.2013, 18:32:39 via Website

Ist R.id.tabHost richtig oder falsch geschrieben? Weil es in der XML tabhost heißt.

— geändert am 17.11.2013, 18:32:57

Antworten
superSharp
  • Forum-Beiträge: 89

17.11.2013, 21:04:47 via Website

Erbt deine Activity von TabActivity?

Danke :)

Antworten