Android 中的选项卡主机问题

发布于 2024-12-29 20:08:06 字数 1065 浏览 3 评论 0原文

我想在屏幕底部显示一个选项卡,所以我使用

<TabHost
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <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" >
        </FrameLayout>

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@android:id/tabcontent" />
    </RelativeLayout>
</TabHost>

但也想在选项卡小部件下方显示一个按钮。在屏幕底部,我们有一个按钮和一个选项卡小部件,该小部件位于按钮上方,但应位于屏幕底部。

有任何方法可以做到这一点。

请向我推荐可用的链接或示例代码。

I want to display a tab at bottom of screen , so i use

<TabHost
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <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" >
        </FrameLayout>

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@android:id/tabcontent" />
    </RelativeLayout>
</TabHost>

but also want to display a button below tab widget . At bottom of screen , we have a button and a tab widget which is above button but should be at bottom of screen .

There is any way for doing it.

Please suggest me usable link or sample code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦冥 2025-01-05 20:08:06

使用线性布局并将 tabhost 和按钮放入其中

use linear-layout and put the tabhost and button in it

爱她像谁 2025-01-05 20:08:06

我不确定,但采用一种线性或相对布局。
首先放置 TabHost,然后在 TabHost 下方的新布局中放置一个按钮。

我没用过,但我认为它会起作用

I am not sure but take one Linear or Relative Layout.
Put TabHost first and then put a button in that new Layout below TabHost.

I have not used it but I think it will work

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文