当前位置:网站首页>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); }
}

边栏推荐
- Sator launched Web3 game "satorspace" and launched hoobi
- textSwitch文本切换器的功能和用法
- Is AI more fair than people in the distribution of wealth? Research on multiplayer game from deepmind
- 第1章CRM核心业务介绍
- 数值 - number(Lua)
- [Fantan] how to design a test platform?
- Sator推出Web3游戏“Satorspace” ,并上线Huobi
- Sator launched Web3 game "satorspace" and launched hoobi
- 第二十四届中国科协湖南组委会调研课题组一行莅临麒麟信安调研考察
- Sator推出Web3游戏“Satorspace” ,并上线Huobi
猜你喜欢

alertDialog創建对话框

Is AI more fair than people in the distribution of wealth? Research on multiplayer game from deepmind

【信息安全法律法规】复习篇

Biped robot controlled by Arduino

麒麟信安中标国网新一代调度项目!

Numberpick的功能和用法

赋能智慧电力建设 | 麒麟信安高可用集群管理系统,保障用户关键业务连续性

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

【信息安全法律法規】複習篇

A tour of grpc:03 - proto serialization / deserialization
随机推荐
[Huang ah code] Why do I suggest you choose go instead of PHP?
[Fantan] how to design a test platform?
PLC: automatically correct the data set noise, wash the data set | ICLR 2021 spotlight
从DevOps到MLOps:IT工具怎样向AI工具进化?
请将磁盘插入“U盘(H)“的情况&无法访问 磁盘结构损坏且无法读取
Numberpick的功能和用法
Share the latest high-frequency Android interview questions, and take you to explore the Android event distribution mechanism
How to implement safety practice in software development stage
第3章业务功能开发(安全退出)
本周小贴士131:特殊成员函数和`= default`
【信息安全法律法规】复习篇
L1-025 正整数A+B(Lua)
LeetCode 535(C#)
【网络攻防原理与技术】第5章:拒绝服务攻击
ViewSwitcher的功能和用法
本周小贴士#134:make_unique与私有构造函数
麒麟信安操作系统衍生产品解决方案 | 存储多路径管理系统,有效提高数据传输可靠性
数值 - number(Lua)
第3章业务功能开发(实现记住账号密码)
《世界粮食安全和营养状况》报告发布:2021年全球饥饿人口增至8.28亿