Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以在android中实现像iOS一样的底部选项卡栏功能?_Android_Android Layout_Android Tabhost - Fatal编程技术网

是否可以在android中实现像iOS一样的底部选项卡栏功能?

是否可以在android中实现像iOS一样的底部选项卡栏功能?,android,android-layout,android-tabhost,Android,Android Layout,Android Tabhost,在iOS中,底部选项卡栏功能非常基本。但在android中,我无法实现这一功能。 我的想法如下。 选项卡栏包含短信、呼叫、摄像头-3个选项卡栏图标。 每当点击此图标时,我都想运行安卓设备上安装的短信、电话和摄像头。 但这些应该与iOS选项卡视图相同。(不应该是全屏) 我已经找到解决办法很久了,但我找不到正确的方法。 请帮帮我 谢谢是的,可能是底部的选项卡栏 试试这个 将其放入XML中 <RelativeLayout xmlns:android="http://schemas.andro

在iOS中,底部选项卡栏功能非常基本。但在android中,我无法实现这一功能。 我的想法如下。 选项卡栏包含短信、呼叫、摄像头-3个选项卡栏图标。 每当点击此图标时,我都想运行安卓设备上安装的短信、电话和摄像头。 但这些应该与iOS选项卡视图相同。(不应该是全屏) 我已经找到解决办法很久了,但我找不到正确的方法。 请帮帮我
谢谢

是的,可能是底部的选项卡栏 试试这个


将其放入XML中

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/home_background_color"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.TabLayout
    android:id="@+id/tabLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="@color/white"
    app:tabPadding="10dp"
    android:minHeight="100dp"
    app:tabGravity="fill"
    app:tabIndicatorColor="@color/app_primary_color"
    app:tabMode="fixed"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

我已经在我的一个应用程序中实现了你所说的。我会很快发布xm

    <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">


            <android.support.v4.view.ViewPager    
                android:id="@+id/viewpager"    
                android:layout_width="match_parent"    
                android:layout_height="match_parent"    
                android:layout_alignParentTop="true"    
                app:layout_behavior="@string/appbar_scrolling_view_behavior"
                android:layout_above="@+id/app_bar"/>

            <android.support.design.widget.AppBarLayout    
                android:id="@+id/app_bar"    
                android:layout_width="match_parent"    
                android:layout_height="wrap_content"    
                android:layout_alignParentBottom="true"    
                android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                android:background="@color/background"
                >

                <com.****.****.ui.custom.IconTextTabLayout    
                    android:id="@+id/tabs"    
                    android:layout_width="match_parent"    
                    android:layout_height="@dimen/custom_tab_layout_height"
                    app:tabGravity="fill"
                    app:tabMode="fixed" />
            </android.support.design.widget.AppBarLayout>
</RelativeLayout>


我的
是的,你是对的,但我认为这不是我们展示安卓设备上安装的应用程序的方式。我正在尝试,但他们同时全屏显示,选项卡栏不显示。伙计,你需要在开关的每个盒子里放上意图,以特定的意图启动你想要的各个应用程序,这是你问题的答案,而不是你需要澄清你想要什么的问题谢谢你的回答。但我已经试过了。那么,我可以问你一个问题吗?你能在一些线性布局中运行已安装的应用程序吗?我期待着你的答复。谢谢你的好意。你具体的问题是什么?可以用标签栏显示短信、电话、照相机吗?是的,你是对的,但我认为这不是我们显示安卓设备上安装的应用程序的方式。我正在尝试,但它们同时显示全屏,选项卡栏不显示。
 try
    {
        tabLayout.addTab(tabLayout.newTab());
        tabLayout.addTab(tabLayout.newTab());
        tabLayout.addTab(tabLayout.newTab());
        tabLayout.addTab(tabLayout.newTab());
        tabLayout.getTabAt(0).setIcon(R.drawable.tab_icon1);
        tabLayout.getTabAt(1).setIcon(R.drawable.tab_icon2);
        tabLayout.getTabAt(2).setIcon(R.drawable.tab_icon3);
        tabLayout.getTabAt(3).setIcon(R.drawable.tab_icon4);
    }
    catch (Exception e)
    {
        Log.e("TabLayout Creation Error",e.getMessage());
    }



    tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
        @Override
        public void onTabSelected(TabLayout.Tab tab) {
switch(tabLayout.getSelectedTabPosition())
    {
    case 0:

break;
        case 1:
//Do the stuff
break;
        case 2:
//Do the stuff
break;
        case 3:
//Do the stuff
break;
        }
     }

        @Override
        public void onTabUnselected(TabLayout.Tab tab) {

        }

        @Override
        public void onTabReselected(TabLayout.Tab tab) {

        }
    });
    <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">


            <android.support.v4.view.ViewPager    
                android:id="@+id/viewpager"    
                android:layout_width="match_parent"    
                android:layout_height="match_parent"    
                android:layout_alignParentTop="true"    
                app:layout_behavior="@string/appbar_scrolling_view_behavior"
                android:layout_above="@+id/app_bar"/>

            <android.support.design.widget.AppBarLayout    
                android:id="@+id/app_bar"    
                android:layout_width="match_parent"    
                android:layout_height="wrap_content"    
                android:layout_alignParentBottom="true"    
                android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                android:background="@color/background"
                >

                <com.****.****.ui.custom.IconTextTabLayout    
                    android:id="@+id/tabs"    
                    android:layout_width="match_parent"    
                    android:layout_height="@dimen/custom_tab_layout_height"
                    app:tabGravity="fill"
                    app:tabMode="fixed" />
            </android.support.design.widget.AppBarLayout>
</RelativeLayout>