iPhone- like tab bar in Android?

我怕爱的太早我们不能终老 提交于 2019-11-29 02:35:18

问题


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.

what is the most close approach to this in 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?


回答1:


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

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


(source: android.com)




回答2:


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

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.




回答3:


There are a couple of examples around

http://www.anddev.org/code-snippets-for-android-f33/iphone-tabs-for-android-t14678.html

This one is scrollable http://code.google.com/p/mobyfactory-uiwidgets-android/




回答4:


<?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>


来源:https://stackoverflow.com/questions/3330969/iphone-like-tab-bar-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!