まず! 私は "生成されたを使用しました Activity
タブナビゲーションタイプを使用します。自動生成に使用した Tab
の制御 Activity
。その最新の ADT。おもう :(、、 今私の質問は私がどのように使用するのですか Fragments
他から Activity
に Tab
内容
第二に、 別のものを置くための他の方法はありますか Activity
内部 Tab
その上に、そのMainACtivity.classを言うことができますコンテンツ.... ....
持っていることを計画する3 Tab
3種類のs Activity
それぞれ1を含むs Activity
〜ごと tab
コンテンツ
本当に私はアイデアや情報源を使い果たしたウルの助け人を必要としています:( :( ... アンドロイド開発に新しい種類のように穏やかになります。 :)
回答:
回答№1は1tab.xml:
<?xml version="1.0" encoding="utf-8"?>
<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">
<RelativeLayout
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"
android:layout_marginTop="60dp"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp"/>
</RelativeLayout>
</TabHost>
activity.javaファイルに以下のコードを追加します。
によってあなたの活動を拡張する android.app.TabActivity
の代わりに Activity
TabHost tabHost=getTabHost();
TabHost.TabSpec spec;
Intent intent;
intent=new Intent().setClass(YourActivity.this, NewActivity.class);
spec=tabHost.newTabSpec("tab1").setIndicator("imageId").setContent(intent);
tabHost.addTab(spec);
intent=new Intent().setClass(YourActivity.this, New1Activity.class);
spec=tabHost.newTabSpec("tab2").setIndicator("imageId").setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
同じように、あなたはあなたの活動にいくつでもタブを追加することができます。