簡體   English   中英

實現“底部導航選項卡欄”的可靠方法

[英]Robust way to implement “bottom navigation tab bar”

效果是這樣的:

在此處輸入圖片說明

我研究了一些方法。

有人使用radiogroup ,有人使用tabhost

最簡單的方法是什么?

還有其他辦法嗎?

谷歌在標簽設計指南中並不是真正推薦的東西,如果您仍然想使用它,我認為TabHost是完美的方法。有關更多信息,請參見如何在屏幕底部對齊 TabHost

<?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">
    <RelativeLayout
        android:layout_height="fill_parent"
        android:layout_width="fill_parent">
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_alignParentBottom="true"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp" />
    </RelativeLayout>
</TabHost>

簽出此鏈接 ,其中包含每種標簽類型(例如,圓圈,下划線等)的庫和示例代碼。

使用此庫,可以實現不同類型的選項卡格式。 您的工作只是將此庫導入到您的應用程序中。

並且, 示例將幫助您了解不同的選項卡格式。

祝一切順利!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM