0

在我的应用程序中,我有一个标签栏。它包含四个选项卡,我在其中显示列表视图。它工作正常,但现在我需要将标签栏移到屏幕底部。当我更改代码以在视图底部显示选项卡栏时,列表视图也以与选项卡栏重叠的全屏显示。

这是示例代码

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/mainlayout"
             android:layout_height="fill_parent" 
             android:layout_width="fill_parent"
             android:orientation="vertical" >
    <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:orientation="vertical"
        android:background="#000000">

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

            <TextView xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/Label"
                    android:layout_width="fill_parent" 
                    android:layout_height="wrap_content" 
                    android:text="Credit Balance"
                    android:background = "#55000000"
                    android:textColor = "#FF0033"
            />

            <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content" 
                    **android:layout_alignParentBottom = "true"**/>
            <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:padding="5dp" />
        </RelativeLayout>
    </TabHost>
</FrameLayout>

我使用以下代码在 4 个各自的选项卡中添加 4 个列表视图

 tabHost.addTab(tabHost.newTabSpec(NEW_TAB).setIndicator(NEW)
            .setContent(new Intent(this, NEWActivity.class)));

请问有人可以提出解决方案吗?

谢谢

4

1 回答 1

3

添加这个

android:layout_above="@android:id/tabs"

线到你的 FrameLayout 和

android:layout_alignParentBottom = "true"

在 TabWidget

于 2011-05-09T11:26:18.180 回答