【问题标题】:Custom tab bar in android?android中的自定义标签栏?
【发布时间】:2014-05-23 21:37:54
【问题描述】:

我想将底部标签栏显示为 MAC 系统停靠菜单

如何在android中实现这个停靠菜单

【问题讨论】:

    标签: android


    【解决方案1】:

    TabHost 没有提供太多工具来定制那里的布局。所以我做了什么,我创建了一个我想要的布局,结合 ImageView 并将它的点击转移到相对 TabWidget。我创建了如下布局。

    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
    
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1"/>
    
        <FrameLayout 
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="fill_horizontal">
    
            <include 
                android:id="@+id/customtab"
                layout="@layout/customtablayout"/>
          <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:visibility="invisible"
            android:layout_weight="0" />
    
          </FrameLayout>
    </LinearLayout>
    

    这里customtablayout 是我的布局,带有图像作为选项卡(您可以添加 anithing)。当我点击一张图片时,我打电话给tabHost.setCurrentTab(index);

    【讨论】:

      【解决方案2】:
      1. 您可以检查(标签带有图像):How to change the Tabs Images in the TabHost

      2. 您对图像应用镜像效果

      3. 设置动画以调整视图大小Resizing layouts programmatically (as animation)

      【讨论】:

        猜你喜欢
        • 2011-04-24
        • 1970-01-01
        • 2021-12-13
        • 2021-05-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-05-07
        • 2015-10-16
        相关资源
        最近更新 更多