[英]Difference tabActivity and tabhost and tab Layout
What is difference between tabActivity
and tabhost
and tabLayout
in Android? Android中的
tabActivity
和tabhost
以及tabLayout
什么区别?
My layout will have five tabs. 我的布局将有五个选项卡。 Which one is best for this?
哪一个最适合这个?
Documentation about making swipe views / tabs: 有关制作滑动视图/标签的文档:
http://developer.android.com/design/building-blocks/tabs.html http://developer.android.com/design/building-blocks/tabs.html
http://developer.android.com/training/implementing-navigation/lateral.html http://developer.android.com/training/implementing-navigation/lateral.html
TabActivity: TabActivity:
deprecated in API level 13 在API级别13中弃用
http://developer.android.com/reference/android/app/TabActivity.html http://developer.android.com/reference/android/app/TabActivity.html
TabHost: TabHost:
http://developer.android.com/reference/android/widget/TabHost.html http://developer.android.com/reference/android/widget/TabHost.html
TabActivity
is deprecated. TabActivity
已弃用。 You should use Fragments and FragmentManager instead. 您应该使用Fragments和FragmentManager。
TabHost
and TabWidget
simply define a portion of the screen for tabs and tab content. TabHost
和TabWidget
简单地定义标签和标签内容的屏幕的一部分。 There are ways to use them with a TabActivity
, but it is not compulsory to do so. 有一些方法可以将它们与
TabActivity
一起使用,但这不是必须的。 Note that there is now a FragmentTabHost
class that you can consider as well. 请注意,现在还可以考虑使用
FragmentTabHost
类。
If you want these tabs to actually be in the same Activity and be able to swipe between them, you can also consider using a ViewPager
with a PagerTabStrip
on top: https://developer.android.com/training/implementing-navigation/lateral.html 如果您希望这些选项卡实际位于同一个Activity中并且能够在它们之间滑动,您还可以考虑在顶部使用带有
ViewPager
的PagerTabStrip
: https : //developer.android.com/training/implementing-navigation/lateral html的
Try this way,hope this will help you to solve your problem 试试这种方式,希望这可以帮助您解决问题
As we know Tab-Activity is now depreciated in Android, but some time we use it for create simple Tab pages in our application. 我们知道Tab-Activity现在已在Android中折旧,但有一段时间我们使用它在我们的应用程序中创建简单的Tab页面。 So,These days we use Host Activity in android
所以,这些天我们在android中使用Host Activity
In android there are many layouts available for a developer to represent maximum functionality with vivid User Interface (UI). 在Android中,有许多布局可供开发人员使用生动的用户界面(UI)来表示最大功能。 Tab Layout is also one of them.
标签布局也是其中之一。 In Tab Layout there are multiple tabs which holds one activity in each one tab.
在选项卡布局中,有多个选项卡,每个选项卡中包含一个活动。 Simply user will get four activities on only one activity contains tabs.
用户只需在一个包含选项卡的活动上获得四项活动。 Current activity in Tab Layout will appear as per tab clicked.
选项卡布局中的当前活动将根据单击的选项卡显示。 In this topic customization of Tab Layout will be covered.
在本主题中,将介绍选项卡布局的自定义。
Mostly we used :- 我们大多使用: -
1. TabHost
2. TabWidget
3. TabHost.TabSpec
4. FrameLayout
5. Intent
You should use tabHost for creating a tabs. 您应该使用tabHost创建选项卡。
This class was deprecated in API level 13. New applications should use Fragments instead of this class;
此类在API级别13中已弃用。新应用程序应使用Fragments而不是此类; to continue to run on older devices, >you can use the v4 support library which provides a version of the Fragment API that is compatible >down to DONUT.
要继续在旧设备上运行,>您可以使用v4支持库,该库提供与DONUT兼容的Fragment API版本。
Container for a tabbed window view.
标签窗口视图的容器。 This object holds two children: a set of tab labels that the >user clicks to select a specific tab, and a FrameLayout object that displays the contents of that >page.
该对象包含两个子项:>用户单击以选择特定选项卡的一组选项卡标签,以及显示该>页面内容的FrameLayout对象。 The individual elements are typically controlled using this container object, rather than >setting values on the child elements themselves.
通常使用此容器对象控制各个元素,而不是在子元素本身上设置值。
Here is a nice tutorial to get you started - Check this link - Click Here 这是一个很好的教程,让你入门 - 检查此链接 - 点击这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.