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

边栏推荐
猜你喜欢

网络攻防复习篇

第3章业务功能开发(实现记住账号密码)

Mrs offline data analysis: process OBS data through Flink job

【可信计算】第十二次课:TPM授权与会话

Functions and usage of viewflipper

麒麟信安加入宁夏商用密码协会

datepicket和timepicket,日期、时间选择器的功能和用法

PLC: automatically correct the data set noise, wash the data set | ICLR 2021 spotlight

A tour of grpc:03 - proto serialization / deserialization

Devops' operational and commercial benefits Guide
随机推荐
智慧物流平台:让海外仓更聪明
专精特新软件开发类企业实力指数发布,麒麟信安荣誉登榜
使用Stace排除故障的5种简单方法
本周小贴士#140:常量:安全习语
serachview的功能和用法
Flask搭建api服务-生成API文档
【信息安全法律法规】复习篇
麒麟信安携异构融合云金融信创解决方案亮相第十五届湖南地区金融科技交流会
本周小贴士#136:无序容器
L1-025 正整数A+B(Lua)
First in China! Todesk integrates RTC technology into remote desktop, with clearer image quality and smoother operation
PLC: automatically correct the data set noise, wash the data set | ICLR 2021 spotlight
Function and usage of numberpick
SlashData开发者工具榜首等你而定!!!
textSwitch文本切换器的功能和用法
calendarview日历视图组件的功能和用法
LeetCode 890(C#)
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?
redis主从、哨兵主备切换搭建一步一步图解实现
Flask搭建api服务-SQL配置文件