public class MainActivty extends Activity {
    /** Called when the activity is first created. */
 public TabHost tabHost;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        tabHost=(TabHost)findViewById(R.id.TabHost01);
        tabHost.setup();
        tabHost.addTab(tabHost.newTabSpec("tab1").setContent(R.id.LinearLayout1).setIndicator("TTTTTTTTTT"));
        tabHost.addTab(tabHost.newTabSpec("tab2").setContent(R.id.LinearLayout2).setIndicator("BBBBBBBBBBBB"));
        tabHost.setCurrentTab(0);
    }
 @Override
 public void onConfigurationChanged(Configuration newConfig) {
  // TODO Auto-generated method stub
  super.onConfigurationChanged(newConfig);
  if(newConfig.orientation==Configuration.ORIENTATION_LANDSCAPE){
   setContentView(R.layout.main);
   System.out.println("land");
  }
  if(newConfig.orientation==Configuration.ORIENTATION_PORTRAIT){
   setContentView(R.layout.main);
   System.out.println("port");
  }
  
  
 }
   
}

xml:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:andro>
                                </TextView>
                        </LinearLayout>
                </FrameLayout>
        </LinearLayout>
</TabHost>

其中:TabWidget android:

相关文章:

  • 2022-02-07
  • 2022-12-23
  • 2021-08-19
  • 2021-11-29
  • 2021-08-29
  • 2022-12-23
  • 2022-01-27
  • 2021-08-02
猜你喜欢
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
相关资源
相似解决方案