Я новичок в android. Я хотел бы иметь tabhost с включенными, но вкладки не будут отображаться. Это 2 включает в себя простые или базовые логические входы, такие как текстовые поля и кнопки. Все коды находятся в этом основном действии, например, сохраняя материал db и другие.TabHost и включают
Вот код.
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabHost"
android:layout_width="fill_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/line"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"></TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1">
<include android:id="@+id/layout1"
layout="@layout/layout_add_details"
android:layout_width="match_parent"
android:layout_height="match_parent"></include>
<include android:id="@+id/layout2"
layout="@layout/layout_add_number"
android:layout_width="match_parent"
android:layout_height="match_parent"></include>
</FrameLayout>
</LinearLayout>
</TabHost>
Вот как я настроить tabhost.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
TabHost tab = (TabHost) findViewById(R.id.tabHost);
tab.setup();
TabHost.TabSpec spec1 = tab.newTabSpec("TAB 1");
spec1.setIndicator("TAB 1");
spec1.setContent(R.id.layout1);
tab.addTab(spec1);
TabHost.TabSpec spec2 = tab.newTabSpec("TAB 2");
spec2.setIndicator("TAB 2");
spec2.setContent(R.id.layout2);
tab.addTab(spec2);
}
Заранее благодарен!