0

私はTabActivityこのコードでやった:

addTab(publication, "First", My_Files.class);
addTab(shop, "Second", Others.class); 

private void addTab(String labelId, int drawableId, Class<?> c)
{
    TabHost tabHost = getTabHost();  // The activity TabHost

    Intent intent = new Intent(this, c);
    TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId); 

    View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false);
    TextView title = (TextView) tabIndicator.findViewById(R.id.title);
    title.setText(labelId);
    ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
    icon.setImageResource(drawableId);

    spec.setIndicator(tabIndicator);
    spec.setContent(intent);
    tabHost.addTab(spec);
}

これらの最初と 2 番目のタブにはListView、ユーザーがそれを押すと、Activity次のコードで他に移動するコンテキストを持つ s があります。

    Intent intent = new Intent("android.app.reader.FILES");  
    intent.putExtra("publicatonName", "fileName");
    startActivity(intent);

しかし、私の が消えますが、それでも iPhoneのTabActivityように使いたいです UITabBarUINavigationController

だから今、私は他のものに行くとき、現在のボタンクラスのターゲットを現在のActivityものに変更する必要があると考えています。TabActivityTab Bar Activity

誰かが私を助けてくれるかもしれません。

ありがとう。

4

1 に答える 1

1

これは、他のアクティビティのコンテナーになります。ユーザーがいずれかのボタンをクリックすると、LocalActivityManager への参照が取得され、それを使用して開始され、内部アクティビティが埋め込まれます。ここからいくつかの経験を積み、また

于 2012-02-22T15:02:51.337 に答える