アプリケーションにタブホストを表示しているときに問題があります。私はどんなタイプのコードを試してみました。私はtabwidget @android:id/tabsやその他のものを呼び出さなければならないことは知っていますが、私のアプリケーションでタブ付きのビューを表示することはできません。私はそれに4つのタブが必要で、私はどのように行うのか分からない。私たちを手伝ってくれますか?????TabHostが表示されない
あなたのいくつかは、コードを望んでいるとして、ここにある:
<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:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<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" >
<TextView
android:id="@+id/textview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a tab" />
<TextView
android:id="@+id/textview2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is another tab" />
<TextView
android:id="@+id/textview3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a third tab" />
</FrameLayout>
</LinearLayout>
とJavaで:
TabHost mTabHost = (TabHost)findViewById(android.R.id.tabhost);
mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("TAB 1").setContent(R.id.textview1));
mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("TAB 2").setContent(R.id.textview2));
mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("TAB 3").setContent(R.id.textview3));
mTabHost.setCurrentTab(0);
それは私が上のリンクから取ったコードです最初の答え。
私たちは何を答えたらいいのかわかりません。何らかのコードを入力してください。 – xyz
私はコードを持っていない、私はちょうど私がインターネットで見つけたものを試した – Cippo
あなたはこれまでに何を持っていますか?いくつかのコードを表示できますか? – goodm