开发者

How to set tab bar at the bottom in android?

开发者 https://www.devze.com 2023-02-11 06:19 出处:网络
I am using a tab bar in android. By default, it displays at the top. I want it to be displayed at the bottom.

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?


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.


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


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

精彩评论

暂无评论...
验证码 换一张
取 消