当前位置:网站首页>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); }
}
边栏推荐
- 【可信计算】第十一次课:TPM密码资源管理(三) NV索引与PCR
- 【源码解读】| LiveListenerBus源码解读
- 【可信计算】第十三次课:TPM扩展授权与密钥管理
- serachview的功能和用法
- The mail server is listed in the blacklist. How to unblock it quickly?
- 简单的loading动画
- DNS series (I): why does the updated DNS record not take effect?
- Rpcms method of obtaining articles under the specified classification
- 【TPM2.0原理及应用指南】 16、17、18章
- Lex & yacc of Pisa proxy SQL parsing
猜你喜欢
随机推荐
在窗口上面显示进度条
How to choose the appropriate automated testing tools?
Solidity 开发环境搭建
大笨钟(Lua)
How to implement safety practice in software development stage
[Fantan] how to design a test platform?
Notes on installing MySQL in centos7
L1-025 正整数A+B(Lua)
centos7安装mysql笔记
Functions and usage of imageswitch
actionBar 导航栏学习
rpcms获取指定分类下的文章的方法
策略模式 - Unity
本周小贴士#140:常量:安全习语
字符串 - string(Lua)
Repair method of firewall system crash and file loss, material cost 0 yuan
Sator a lancé le jeu web 3 "satorspace" et a lancé huobi
Functions and usage of viewswitch
DevOps 的运营和商业利益指南
99%的人都不知道|私有化部署还永久免费的即时通讯软件!