Android的动作条后退按钮和标签按钮、动作、标签、Android

2023-09-12 02:39:42 作者:星辰

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

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:

http://developer.android.com/resources/samples/ActionBarCompat/ index.html的

我还包含一个 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.