我的第一页包含3个标签。我希望在整个应用程序中保留所有这三个选项卡。这意味着我想在每个视图中看到这3个选项卡。例如:我有3个视图。第一个视图是Main.class。它包含3个选项卡(主页选项卡,收藏夹选项卡,设置选项卡)。当我单击任何一个选项卡(例如:主页选项卡)时,它会在这些选项卡下方显示Home.class(ListView)的内容。但是,当我单击ListView视图时,它将转到另一个活动(SubListView.class),我无法看到该活动中的选项卡。此处仅显示该视图的内容。如何在该视图中显示这些标题选项卡?
主视图:(在Main.class中)
final TabHost tabHost = getTabHost();
Intent intent;
LayoutInflater.from(this).inflate(R.layout.main, tabHost.getTabContentView(),true);
tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator("Home",getResources().getDrawable(R.drawable.img_home)).setContent(new Intent(this, Home.class)));
tabHost.addTab(tabHost.newTabSpec("tab2").setIndicator("Favourites",getResources().getDrawable(R.drawable.img_fav)).setContent(new Intent(this, Favourites.class)));
tabHost.addTab(tabHost.newTabSpec("tab3").setIndicator("Settings",getResources().getDrawable(R.drawable.img_set)).setContent(new Intent(this, Settings.class)));
tabHost.setCurrentTab(0);
主页视图:(在Home.class中)
public ArrayAdapter<String> adapter;
final ArrayList<String> results = new ArrayList<String>();
ListView listitems=(ListView)findViewById(R.id.list);
adapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,results);
listitems.setAdapter(adapter);
listitems.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
//@Override
public void onItemClick(AdapterView arg0, View view, int position, long id)
{
categoryNameFromList=results.get(position);
Bundle category_bundle = new Bundle();
category_bundle.putString("selected_item",categoryNameFromList);
Intent category_intent = new Intent(view.getContext(), SubListView.class);
category_intent.putExtras(category_bundle);
startActivityForResult(category_intent, 1);
}
});
SubList View(在SubListView.class中)
TextView txtmessage=new TextView(this);
txtmessage.setTex("WELOCME TO SUB LIST VIEW!!");
setContentView(txtmessage);
请帮帮我..提前感谢你..