我的应用程序中有4个选项卡,它是在android中开发的。 我想知道当我从一个标签导航到另一个标签时会触发哪个事件。
我应该在代码中使用此事件?
public class Test extends TabActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TabHost host = getTabHost();
host.addTab(host.newTabSpec("Test1").setIndicator(new MyView(this,
R.drawable.icon, "Test1")).setContent(new Intent(this, Test1.class)));
host.addTab(host.newTabSpec("Test2").setIndicator(new MyView(this,
R.drawable.compass, "Test2")).setContent(new Intent(this, Test2.class)));
host.addTab(host.newTabSpec("Test3").setIndicator(new MyView(this,
R.drawable.mosquebg, "Test3")).setContent(new Intent(this,
Test3.class)));
host.addTab(host.newTabSpec("Settings").setIndicator(new MyView(this,
R.drawable.icon, "Settings")).setContent(new Intent(this, Settings.class)));
host.getTabWidget().setBackgroundResource(R.drawable.background);
host.getTabWidget().getChildAt(0).getLayoutParams().height=35;
host.getTabWidget().getChildAt(1).getLayoutParams().height=35;
host.getTabWidget().getChildAt(2).getLayoutParams().height=35;
host.getTabWidget().getChildAt(3).getLayoutParams().height=35;
}
}