Android 中类似 iPhone 的标签栏?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3330969/
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 09:46:06  来源:igfitidea点击:

iPhone- like tab bar in Android?

androidandroid-tabhost

提问by Mina Samy

In iPhone we can create a view that has a tab bar and make it the root view of the application then use the tab bar to navigate through sub views.

在 iPhone 中,我们可以创建一个带有标签栏的视图,并使其成为应用程序的根视图,然后使用标签栏导航子视图。

what is the most close approach to this in Android?

在 Android 中最接近的方法是什么?

Is it to use a Tabbed Control? but this includes using just one activity.

是否使用选项卡式控件?但这包括只使用一项活动。

what is the approach to use in Android to create an activity with a navigation control to other activities in a way similar to that of the iPhone?

在 Android 中使用什么方法来创建一个带有导航控件的活动,以类似于 iPhone 的方式访问其他活动?

采纳答案by binaryorganic

There's a tutorialfor creating a "Tab Layout" on the android dev site:

在 android 开发站点上有一个创建“选项卡布局”的教程

You can implement your tab content in one of two ways: use the tabs to swap Views within the same Activity, or use the tabs to change between entirely separate activities

您可以通过以下两种方式之一实现选项卡内容:使用选项卡在同一活动中交换视图,或使用选项卡在完全独立的活动之间切换

Tab Layout
(source: android.com)

标签布局
(来源:android.com

回答by Waza_Be

Sorry, I really don't know the iPhone, but may a QuickAction Dialog help you??

抱歉,我真的不懂 iPhone,但 QuickAction Dialog 可以帮到你吗??

http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/

http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/

I imagine a list of some activities in that dialog.

我想象了该对话框中一些活动的列表。

I hope this is close to what you want.

我希望这接近你想要的。

回答by Ramindu Weeraman

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@android:id/tabhost" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"        
android:layout_marginBottom="0dp" 
>
    <FrameLayout
    android:id="@android:id/tabcontent"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"            
    android:layout_weight="1" 
    />

    <TabWidget
    android:id="@android:id/tabs"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="0"
   />
</LinearLayout>
</TabHost>