当前位置:网站首页>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); }
}
边栏推荐
- [video / audio data processing] Shanghai daoning brings you elecard download, trial and tutorial
- 鲲鹏开发者峰会2022 | 麒麟信安携手鲲鹏共筑计算产业新生态
- 【可信计算】第十次课:TPM密码资源管理(二)
- Devops' operational and commercial benefits Guide
- 麒麟信安携异构融合云金融信创解决方案亮相第十五届湖南地区金融科技交流会
- 状态模式 - Unity(有限状态机)
- Flash build API service
- 简单的loading动画
- 99% of users often make mistakes in power Bi cloud reports
- 第3章业务功能开发(安全退出)
猜你喜欢
随机推荐
actionBar 导航栏学习
Flask搭建api服务-生成API文档
【分布式理论】(二)分布式存储
Numberpick的功能和用法
【饭谈】如何设计好一款测试平台?
L1-027 出租(Lua)
跟奥巴马一起画方块(Lua)
[fan Tan] after the arrival of Web3.0, where should testers go? (ten predictions and suggestions)
A tour of grpc:03 - proto serialization / deserialization
Lex & yacc of Pisa proxy SQL parsing
Siggraph 2022 best technical paper award comes out! Chen Baoquan team of Peking University was nominated for honorary nomination
命令模式 - Unity
麒麟信安操作系统衍生产品解决方案 | 存储多路径管理系统,有效提高数据传输可靠性
本周小贴士#141:注意隐式转换到bool
赋能智慧电力建设 | 麒麟信安高可用集群管理系统,保障用户关键业务连续性
第二十四届中国科协湖南组委会调研课题组一行莅临麒麟信安调研考察
企业即时通讯软件是什么?它有哪些优势呢?
Matplotlib绘图界面设置
Ratingbar的功能和用法
notification是显示在手机状态栏的通知