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

边栏推荐
- centos7安装mysql笔记
- datepicket和timepicket,日期、时间选择器的功能和用法
- Flask搭建api服务-SQL配置文件
- 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?
- 使用popupwindow創建对话框风格的窗口
- 第3章业务功能开发(用户访问项目)
- 麒麟信安云平台全新升级!
- 如何在软件研发阶段落地安全实践
- 【重新理解通信模型】Reactor 模式在 Redis 和 Kafka 中的应用
- Function and usage of textswitch text switcher
猜你喜欢
随机推荐
LeetCode 535(C#)
VSCode关于C语言的3个配置文件
Notes on installing MySQL in centos7
【TPM2.0原理及应用指南】 9、10、11章
How to implement safety practice in software development stage
The server is completely broken and cannot be repaired. How to use backup to restore it into a virtual machine without damage?
imageswitcher的功能和用法
Mysql 索引命中级别分析
With the latest Alibaba P7 technology system, mom doesn't have to worry about me looking for a job anymore
toast会在程序界面上显示一个简单的提示信息
【分布式理论】(一)分布式事务
Solidity 开发环境搭建
跟奥巴马一起画方块(Lua)
第3章业务功能开发(用户登录)
Several best practices for managing VDI
麒麟信安携异构融合云金融信创解决方案亮相第十五届湖南地区金融科技交流会
Functions and usage of imageswitch
Biped robot controlled by Arduino
本周小贴士#141:注意隐式转换到bool
本周小贴士131:特殊成员函数和`= default`









