当前位置:网站首页>Functions and usage of tabhost tab
Functions and usage of tabhost tab
2022-07-07 17:37:00 【XLMN】
TabHOST
Functions and usage of tabs
tabhost You can easily place multiple tabs in the window ,, Each tab is equivalent to a component placement area the same size as the external container , In this way , You can put more components in one container
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TabWidget
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@android:id/tabs"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@android:id/tabcontent">
<!-- Define the content of the first tab -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/tb01"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=" Total score of public courses "/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=" The total score of professional courses "/>
</LinearLayout>
<!-- Define the second tab -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/tb02"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=" Total score "/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=" Total score 01"/>
</LinearLayout>
<!-- Define the third tab -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/tb03"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=" Admission to school "/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=" Admission major "/>
</LinearLayout>
</FrameLayout>
public class MainActivity extends TabActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tabhost); // Get change activity Inside ,tabhost Components TabHost th = getTabHost(); // Create the first one tab page TabHost.TabSpec tab1 = th.newTabSpec("tab1").setIndicator(" fraction ").setContent(R.id.tb01); // Add the first tab th.addTab(tab1); TabHost.TabSpec tab2 = th.newTabSpec("tab2") // Place the icon above the label Title .setIndicator(" Total score ", getResources().getDrawable(R.drawable.mia5)) .setContent(R.id.tb02); // Add a second tab th.addTab(tab2); TabHost.TabSpec tab3 = th.newTabSpec("tab3") .setIndicator(" Admission major ") .setContent(R.id.tb03); // Add a third tab th.addTab(tab3); }
}

边栏推荐
- mysql官网下载:Linux的mysql8.x版本(图文详解)
- 【网络攻防原理与技术】第6章:特洛伊木马
- 本周小贴士#140:常量:安全习语
- Sator推出Web3游戏“Satorspace” ,并上线Huobi
- 【TPM2.0原理及应用指南】 16、17、18章
- The computer cannot add a domain, and the Ping domain name is displayed as the public IP. What is the problem? How to solve it?
- 简单的loading动画
- Function and usage of textswitch text switcher
- centos7安装mysql笔记
- Flask build API service SQL configuration file
猜你喜欢

策略模式 - Unity

Sator launched Web3 game "satorspace" and launched hoobi

99%的人都不知道|私有化部署还永久免费的即时通讯软件!

Biped robot controlled by Arduino

Lex & yacc of Pisa proxy SQL parsing

鲲鹏开发者峰会2022 | 麒麟信安携手鲲鹏共筑计算产业新生态

toast会在程序界面上显示一个简单的提示信息

mysql官网下载:Linux的mysql8.x版本(图文详解)

【TPM2.0原理及应用指南】 5、7、8章

A tour of grpc:03 - proto serialization / deserialization
随机推荐
Rpcms method of obtaining articles under the specified classification
专精特新软件开发类企业实力指数发布,麒麟信安荣誉登榜
Functions and usage of viewflipper
Numberpick的功能和用法
第3章业务功能开发(安全退出)
Several best practices for managing VDI
命令模式 - Unity
The server is completely broken and cannot be repaired. How to use backup to restore it into a virtual machine without damage?
From Devops to mlops: how do it tools evolve to AI tools?
DNS series (I): why does the updated DNS record not take effect?
使用popupwindow創建对话框风格的窗口
状态模式 - Unity(有限状态机)
使用 xml资源文件定义菜单
Flask搭建api服务-生成API文档
DatePickerDialog和trimepickerDialog
本周小贴士#134:make_unique与私有构造函数
让保险更“保险”!麒麟信安一云多芯云桌面中标中国人寿, 助力金融保险信息技术创新发展
TabHOST 选项卡的功能和用法
Ratingbar的功能和用法
mysql使用笔记一