如何在 Android Layout 中创建 TAB VIEW

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21177770/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 04:05:27  来源:igfitidea点击:

How to create a TAB VIEW in Android Layout

androidandroid-layoutandroid-listviewandroid-fragments

提问by arun

How to create a tabview, I have gone through many blogs in which they specify that tabview widget is depreciated from lv 8 but i need to create a layout which i have attached below. Can anyone guide me to design a layout like this, such that if i click on weekly this view should be displayed and another activity for today button.

如何创建 tabview,我浏览了许多博客,其中他们指定 tabview 小部件从 lv 8 折旧,但我需要创建一个布局,我在下面附上了。任何人都可以指导我设计这样的布局,这样如果我每周点击这个视图应该显示和今天的另一个活动按钮。

enter image description here

在此处输入图片说明

回答by

For implementing TabViewyou can use ActionBar. You can explore this ActionBarSherLock. Here is the example of this Android Working with Action Bar.

为了实现,TabView您可以使用ActionBar. 您可以探索这个ActionBarSherLock。这是此Android 使用 Action Bar的示例。

回答by Chris Zhang

Rather than go running off to use ActionBarSherlock, simple standard stock Android offers a tutorial and an example project on its site here.

与其跑去使用 ActionBarSherlock,不如直接在 Android 的网站上提供教程和示例项目。

http://developer.android.com/design/patterns/swipe-views.html

http://developer.android.com/design/patterns/swipe-views.html

Familiarize yourself with Fragments and you should be good-to-go so long as you are comfortable already creating the layouts beneath each tab.

熟悉 Fragments,只要您已经习惯在每个选项卡下创建布局,您就应该很容易上手。