当前位置:网站首页>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
- 浅谈 Apache Doris FE 处理查询 SQL 源码解析
- actionBar 导航栏学习
- Dateticket and timeticket, functions and usage of date and time selectors
- 策略模式 - Unity
- datepicket和timepicket,日期、时间选择器的功能和用法
- 【黄啊码】为什么我建议您选择go,而不选择php?
- Solid function learning
- Establishment of solid development environment
- 第2章搭建CRM项目开发环境(数据库设计)
猜你喜欢
imageswitcher的功能和用法
User defined view essential knowledge, Android R & D post must ask 30+ advanced interview questions
赋能智慧电力建设 | 麒麟信安高可用集群管理系统,保障用户关键业务连续性
Several best practices for managing VDI
mysql官网下载:Linux的mysql8.x版本(图文详解)
【重新理解通信模型】Reactor 模式在 Redis 和 Kafka 中的应用
TabHOST 选项卡的功能和用法
第2章搭建CRM项目开发环境(搭建开发环境)
Functions and usage of viewflipper
Sator a lancé le jeu web 3 "satorspace" et a lancé huobi
随机推荐
让保险更“保险”!麒麟信安一云多芯云桌面中标中国人寿, 助力金融保险信息技术创新发展
alertDialog創建对话框
麒麟信安携异构融合云金融信创解决方案亮相第十五届湖南地区金融科技交流会
阿富汗临时政府安全部队对极端组织“伊斯兰国”一处藏匿点展开军事行动
Ratingbar的功能和用法
【TPM2.0原理及应用指南】 5、7、8章
The top of slashdata developer tool is up to you!!!
[Huang ah code] Why do I suggest you choose go instead of PHP?
Sator推出Web3游戏“Satorspace” ,并上线Huobi
Numberpick的功能和用法
serachview的功能和用法
DNS series (I): why does the updated DNS record not take effect?
User defined view essential knowledge, Android R & D post must ask 30+ advanced interview questions
The mail server is listed in the blacklist. How to unblock it quickly?
Establishment of solid development environment
Audio device strategy audio device output and input selection is based on 7.0 code
L1-019 谁先倒(Lua)
SlashData开发者工具榜首等你而定!!!
First in China! Todesk integrates RTC technology into remote desktop, with clearer image quality and smoother operation
赋能智慧电力建设 | 麒麟信安高可用集群管理系统,保障用户关键业务连续性