当前位置:网站首页>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); }
}
边栏推荐
猜你喜欢
alertDialog創建对话框
With the latest Alibaba P7 technology system, mom doesn't have to worry about me looking for a job anymore
Sator a lancé le jeu web 3 "satorspace" et a lancé huobi
A tour of grpc:03 - proto serialization / deserialization
自定义View必备知识,Android研发岗必问30+道高级面试题
第3章业务功能开发(实现记住账号密码)
【信息安全法律法规】复习篇
麒麟信安云平台全新升级!
Share the latest high-frequency Android interview questions, and take you to explore the Android event distribution mechanism
状态模式 - Unity(有限状态机)
随机推荐
第1章CRM核心业务介绍
99%的人都不知道|私有化部署还永久免费的即时通讯软件!
自定义View必备知识,Android研发岗必问30+道高级面试题
Ratingbar的功能和用法
Flash build API service
【黄啊码】为什么我建议您选择go,而不选择php?
[fan Tan] those stories that seem to be thinking of the company but are actually very selfish (I: building wheels)
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?
本周小贴士#135:测试约定而不是实现
imageswitcher的功能和用法
鲲鹏开发者峰会2022 | 麒麟信安携手鲲鹏共筑计算产业新生态
【可信计算】第十一次课:TPM密码资源管理(三) NV索引与PCR
LeetCode 890(C#)
Matplotlib绘制三维图形
MRS离线数据分析:通过Flink作业处理OBS数据
centos7安装mysql笔记
【可信计算】第十三次课:TPM扩展授权与密钥管理
Show progress bar above window
Sator推出Web3游戏“Satorspace” ,并上线Huobi
Lex & yacc of Pisa proxy SQL parsing