Android的动作条后退按钮和标签 [英] Android ActionBar backbutton and tabs

查看:131
本文介绍了Android的动作条后退按钮和标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个动作条而像谷歌+应用程序中的选项卡式浏览。

I want to create an ActionBar and a tabbed navigation like the google+ app.

我用这个例子作为一个起点,我现在有一个很大的动作条:

I used this example as a starting point and now I have a great actionbar:

我还包含一个 ViewPager TabHost 有标签和滚动左/右片段。

I've also included a ViewPager and a TabHost to have tabs and scrolling left/right Fragments.

我需要的是展现给蜂窝状前向后的箭头版本。 如果设置了 getActionBar()。setDisplayHomeAsUpEnabled(真),箭头自动版本> =蜂窝状显示。

What i need is to show the back arrow in version prior to honeycomb. If I set getActionBar().setDisplayHomeAsUpEnabled(true), the arrow is automatically show in version >= honeycomb.

  • 我怎样才能做到这一点在之前的版本蜂蜜?

我也想拥有像谷歌的应用程序+标签。

What I also want to have is Tabs like the google+ app.

这是我的标签栏的外观:

This is how is my tab bar looks:

删除死ImageShack链接

...这就是我想要的:

...and this is what i want:

删除死ImageShack链接

我找不到任何例子风格标签栏就像一个。

I can't find any example to style tab bars like that one.

推荐答案

我会建议你 ActionBarSherlock 获取与Android&LT动作条的兼容性; 3。这是一个更好的实现,这个例子所提供的开发者页面。

I would recommend you the ActionBarSherlock for ActionBar compatibility with Android <3. It is a better implementation that the example offered in the developers page.

使用这个包,后退箭头将在您添加到您的活动下面一行出现。

Using this package, the back arrow will appear when you add to your activity the following line.

getSupportActionBar().setDisplayHomeAsUpEnabled(true);

关于Google+的标签,我已经找到了小部件 ViewFlow 非常有用的,看着完全一样。此外,你没有任何向后兼容问题。看一看到CircleFlowIndicator例子。

Regarding the Google+ tabs, I have found the widget ViewFlow very useful and looking exactly the same. Moreover, you don't have any backward compatibility issues. Have a look to the CircleFlowIndicator example.

这篇关于Android的动作条后退按钮和标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆