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

边栏推荐
- The server is completely broken and cannot be repaired. How to use backup to restore it into a virtual machine without damage?
- Siggraph 2022 best technical paper award comes out! Chen Baoquan team of Peking University was nominated for honorary nomination
- Numberpick的功能和用法
- On Apache Doris Fe processing query SQL source code analysis
- 本周小贴士#140:常量:安全习语
- Function and usage of numberpick
- [fan Tan] after the arrival of Web3.0, where should testers go? (ten predictions and suggestions)
- 百度地图自定义样式向右拖拽导致全球地图经度0度无法正常显示
- [video / audio data processing] Shanghai daoning brings you elecard download, trial and tutorial
- Repair method of firewall system crash and file loss, material cost 0 yuan
猜你喜欢

viewflipper的功能和用法

责任链模式 - Unity

Matplotlib绘图界面设置

LeetCode刷题day49

How to choose the appropriate automated testing tools?

Devops' operational and commercial benefits Guide

Functions and usage of viewflipper

Sator推出Web3游戏“Satorspace” ,并上线Huobi

Function and usage of textswitch text switcher

Leetcode brush questions day49
随机推荐
【可信计算】第十三次课:TPM扩展授权与密钥管理
Solid function learning
【网络攻防原理与技术】第7章:口令攻击技术 第8章:网络监听技术
LeetCode刷题day49
LeetCode 515(C#)
Functions and usage of ratingbar
2021-06-28
Leetcode brush questions day49
Solidity函数学习
【黄啊码】为什么我建议您选择go,而不选择php?
rpcms获取指定分类下的文章的方法
网络攻防复习篇
[fan Tan] those stories that seem to be thinking of the company but are actually very selfish (I: building wheels)
【网络攻防原理与技术】第6章:特洛伊木马
本周小贴士131:特殊成员函数和`= default`
Sator推出Web3游戏“Satorspace” ,并上线Huobi
textSwitch文本切换器的功能和用法
Share the latest high-frequency Android interview questions, and take you to explore the Android event distribution mechanism
What is cloud computing?
L1-027 出租(Lua)