Changing the view in TabHost in Android

南楼画角 提交于 2019-12-25 05:37:08

问题


How Can i change the TabHost in android, so it should look same as UITabBarController in iPhone? ie view should be on the top of the TabHost,not at the bottom.


回答1:


Here's a sample layout code to have the tabs on the bottom of the screen:

<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">
    <FrameLayout android:id="@android:id/tabcontent"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_weight="1">
    </FrameLayout>
    <TabWidget android:id="@android:id/tabs"
        android:layout_width="fill_parent" android:layout_height="65dp"
        android:layout_marginLeft="0dip" android:layout_marginRight="0dip"
        android:layout_weight="0"></TabWidget>
</LinearLayout>
</TabHost>


来源:https://stackoverflow.com/questions/5978079/changing-the-view-in-tabhost-in-android

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