[英]TabActivity and navigation inside Android
我用以下代碼完成了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);
}
在這些第一個和第二個選項卡中,我具有ListView
帶有一些上下文,用戶可以在其中按下該代碼,並使用以下代碼轉到其他Activity
:
Intent intent = new Intent("android.app.reader.FILES");
intent.putExtra("publicatonName", "fileName");
startActivity(intent);
但也有消失我TabActivity
,但我仍然想使用它像iPhone UITabBar
用UINavigationController
所以現在我在想,當我轉到其他“ Activity
我需要將當前的TabActivity
按鈕類目標更改為“當前”,並且以某種方式應該可以看到我的“ Tab Bar Activity
。
也許有人可以幫助我。
謝謝。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.