你的位置:首页 > 软件开发 > 操作系统 > TabHost 选项卡

TabHost 选项卡

发布时间:2015-09-09 17:00:09
Refer to :http://android.toolib.net/reference/android/widget/TabHost.html tabHost=(TabHost)findViewById(android.R.id.tabhost);  &# ...

Refer to :http://android.toolib.net/reference/android/widget/TabHost.html

tabHost=(TabHost)findViewById(android.R.id.tabhost);    //获取TabHost对象

tabHost.setup();    //初始化TabHost组件

LayoutInflater inflater = LayoutInflater.from(this);     // 声明并实例化一个LayoutInflater对象

//Begin to add more tab.

inflater.inflate(R.layout.tab1, tabHost.getTabContentView());

inflater.inflate(R.layout.tab2, tabHost.getTabContentView());

inflater.inflate(R.layout.tab3, tabHost.getTabContentView());

inflater.inflate(R.layout.tab7, tabHost.getTabContentView());

//inflater.inflate(R.layout.tab4, tabHost.getTabContentView());

 

 

tabHost.addTab(tabHost.newTabSpec("tab01")

        .setIndicator("SET")

        .setContent(R.id.LinearLayout01)); //添加第一个标签页

tabHost.addTab(tabHost.newTabSpec("tab02")

        .setIndicator("VID6X")

        .setContent(R.id.LinearLayout02));     //添加第二个标签页

tabHost.addTab(tabHost.newTabSpec("tab03")

        .setIndicator("VID2X-7X")

        .setContent(R.id.LinearLayout03));

tabHost.addTab(tabHost.newTabSpec("tab04")

        .setIndicator("CCD-TEST")

        .setContent(R.id.LinearLayout07));

 

//tabHost.addTab(tabHost.newTabSpec("tab04")

//        .setIndicator("DASHBOARD")

//         .setContent(R.id.LinearLayout04));

/*选项卡标题高度*/

/* tabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 75;

tabHost.getTabWidget().getChildAt(1).getLayoutParams().height = 75;

tabHost.getTabWidget().getChildAt(2).getLayoutParams().height = 75;

tabHost.getTabWidget().getChildAt(3).getLayoutParams().height = 75; */

原标题:TabHost 选项卡

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录