我一直在寻找一种方法让我的android应用程序在屏幕底部有标签。Android - 屏幕底部的标签
论样式和主题部分Android开发者网站,他们似乎有什么我试图做精确的例子,但是他们并没有觉得有必要提供这样一个体面的例子:
我在网上找到的所有提示/解决方案都失败了。我似乎总是得到下面的对接丑陋的布局,其中的选项卡在屏幕的顶部非常错位的应用程序的名称:-(
旁边有没有人有一个线索如何做到这一点?
非常感谢你提前任何提示
我一直在寻找一种方法让我的android应用程序在屏幕底部有标签。Android - 屏幕底部的标签
论样式和主题部分Android开发者网站,他们似乎有什么我试图做精确的例子,但是他们并没有觉得有必要提供这样一个体面的例子:
我在网上找到的所有提示/解决方案都失败了。我似乎总是得到下面的对接丑陋的布局,其中的选项卡在屏幕的顶部非常错位的应用程序的名称:-(
旁边有没有人有一个线索如何做到这一点?
非常感谢你提前任何提示
我觉得这些例子对你有用:Android Bottom tab bar example和THIS
虽然这可能在理论上回答这个问题,但[这将是更可取的](http://meta.stackoverflow.com/q/8259)在这里包括答案的基本部分,并提供供参考的链接。 – Keelan
我觉得你没有足够的搜索你的问题,因为你使用了错误的关键字搜索。
什么你是显示在Gmail应用程序的底部在第一图象有4个菜单和第五溢出菜单,并以最快的动作条上
可以放置在使用清单一个简单的属性底部的菜单;在主要活动一个单一的线,显示操作栏
android:uiOptions="splitActionBarWhenNarrow"
像这样:
<activity
android:name="com.example.HomeActivity"
android:screenOrientation="portrait"
android:uiOptions="splitActionBarWhenNarrow"
android:theme="@style/Theme.Sherlock.Light" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
它非常简单....
对于简单的标签栏,我们使用
<?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">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="@android:id/tabs"
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" />
</LinearLayout>
</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>**
最主要的是
android:layout_alignParentBottom=”true”;
我用这个布局用于查找bo中的Tabs屏幕TTOM:
?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="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"/>
<FrameLayout
android:id="@+android:id/realtabcontent"
android:background="@drawable/bg_main_app_gradient"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<TabWidget
android:id="@android:id/tabs"
android:background="#EAE7E1"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"/>
</LinearLayout>
</TabHost>
我碰到你的问题寻求做同样的事情,然而,根据机器人发展的指导方针,你不应该曾经有一个在底部的标签栏,因为这是一个iOS的功能...
有趣的是,他们自己的Gmail应用程序曾经在底部有菜单 – Han
你似乎有底部栏有点糊涂。这不是标签栏。底部栏是用于操作,而不是导航屏幕。例如,在上面发布的Gmail应用的屏幕截图中,底部栏允许用户:撰写电子邮件,搜索,标记,刷新等。参考:
从技术上讲,这些按钮可以将用户导航到其他屏幕,但标签栏通常用于“切换”屏幕。例如按类别查看内容。
嗯,但在Gmail应用程序的最新版本中,它们上面有这些操作按钮。叹息...
虽然这个链接可能回答这个问题,但最好在这里包含答案的重要部分并提供参考链接。如果链接页面更改,则仅链接答案可能会失效。 –
感谢您的提示。该链接仅供参考。 – Vasim
谷歌不建议在底部有制表符。
于Android请参见下面的官方设计模式引导,
并查找节“不要使用底部标签栏”
http://developer.android.com/design/patterns/pure-android.html
我想在这里发布更新。 Bottom nav bars are now Android Canon.由此得到的主要结果是:
1)使用底部导航栏只能用于3-5个图标。更少,请使用tabs。再者,使用可滚动的选项卡(在同一链接上的页面)。
2)避免使用底部的导航栏和标签,并确保两者的责任是明确分开,如果你这样做。
3)底部NAV杆应该用于导航不动作(使用ActionBar
那些)
这是没有标签,但分裂的ActionBar。您可以在Android开发人员指南(http://developer.android.com/guide/topics/ui/actionbar.html)中阅读关于它的更多信息。 – Ridcully
@韦斯利,这是一个“分割动作栏”视图功能。你可以找到一些很好的例子。你需要在'Android Manifest'中定义属性。 – 2013-09-22 14:15:52