How to set tab bar at the bottom in android?

安稳与你 提交于 2019-12-03 10:48:22

问题


I am using a tab bar in android.

By default, it displays at the top.

I want it to be displayed at the bottom.

Can someone please explain how to do this?


回答1:


Please check this link: How to align your TabHost at the bottom of the screen

Adding android:layout_alignParentBottom="true" for the TabWidget does the trick.




回答2:


Just place content layout above tab widget. See following link for more info. Android: Tabs at the BOTTOM




回答3:


<?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"
    android:padding="1dp" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:padding="5dp" >

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp" />

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true" />
    </RelativeLayout>>

</TabHost>


来源:https://stackoverflow.com/questions/5014002/how-to-set-tab-bar-at-the-bottom-in-android

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