使用ActionBarSherlock做动作条覆盖 [英] Make ActionBar overlay using ActionBarSherlock

查看:117
本文介绍了使用ActionBarSherlock做动作条覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的几天我一直在做伟大的东西的发展,但我似乎已经碰了壁的东西可能是愚蠢的简单。它很烦人。我希望我能得到一些帮助。

The last few days I've been doing great stuff in development, but I've seem to have hit a wall on something probably stupid simple. It's annoying. I was hoping I could get some help.

我想做什么

我试图创建一个从谷歌音乐的真棒透明的动作条动画效果(如由西里尔Mottier的这里

I'm trying to create the awesome transparent ActionBar animation effect from Google Music (as described by Cyril Mottier here)

问题

我甚至无法获得动作条进入叠加/透明模式。

I can't even get the actionbar to go into overlay / transparent mode.

我的建立

我有一个图书馆为导向建立在Eclipse。我有一个库项目(我们称之为主),它包含所有实际的code和活动。然后,我有一个项目,只是插入主库(我们称之为从站)。最后还有师父用途(其中包括为ActionBarSherlock)一些开源的支持库。

I've got a library-oriented set-up in Eclipse. I've got a library project (let's call it master) that contains all the actual code and activities. Then I've got a project, that just plugs into the master library (let's call it slave). Lastly there's some open source support libraries that master uses (among others is ActionBarSherlock).

我想将此效果是在主库中的活动。它是在奴隶的清单声明为 com.example.master.DetailActivity ,那就像一个魅力。

The activity I'm trying to apply this effect to is in the master library. It is declared in slave's manifest as com.example.master.DetailActivity, and that works like a charm.

另外:本主题活动可能来自几个地方。无论是它的设置由奴隶的清单,或者通过主在运行时。主题可能来自于主或从项目。

Also: The theme for the activity may come from several places. Either it's set by slave's manifest, or by master at runtime. Themes may come from the master OR the slave project.

我已经试过

感觉好像一切。我已经通过创建基于西里尔的文章自定义主题开始了。我确信,对每一个项目我有一个版本,有和没有机器人: preFIX按的杰克沃顿商学院的说明

Feels like everything. I've started out by creating a custom theme based on Cyril's article. I made sure that for every item I've had a version with and without the android: prefix as per Jake Wharton's instructions.

我也试着在运行时用它设置 requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

I've also tried setting it at runtime using requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

我已经得到了

什么也没有。主题成功地应用(可以看我的动作条的颜色相应地变化),但它从来没有进入覆盖模式,也不会变为透明。

Nothing. The theme applied succesfully (I can see the actionbar's colors change appropriately), but it NEVER goes into overlay mode, nor does it become transparent.

帮助将不胜AP preciated,并可能有助于其他的尝试这种效果。

Help would be greatly appreciated, and would probably be helpful to other's trying this effect.

编辑:

下面是我的主题和风格。 codeS是有点乱,因为我一直在尝试与他们看到我要去哪里错了。 AppTheme <$ C C $>和 Theme.TranslucentActionBar.ActionBar.Overlay 双方将无法正常工作。 / RES /价值/

Here are my themes and styles. Codes are kinda messy because I've been experimenting with them to see where I was going wrong. AppTheme and Theme.TranslucentActionBar.ActionBar.Overlay both won't work. /res/values/

  • styles.xml
  • themes.xml

/ RES /值-V11 /

/res/values-v11/

  • styles.xml
  • themes.xml

我测试安装,以及一个模拟器2.3.3一台Nexus 4 4.2.2。

I'm testing on a Nexus 4 with 4.2.2 installed as well as a 2.3.3 emulator.

推荐答案

好了,很明显,我的设置,则无法使用主题做。

OK, so apparently, with my set-up, you can't do it using themes.

我结束它这样做,在全球是这样的。

I ended it up doing it, globally like this.

setTheme(theme.whatever);
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
super.onCreate(savedInstanceState);
setContentView(R.layout.content);
getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.color)); // This is #212121 solid color for the dark action bar.

该行有s $ P $垫出了我的code,但是这是它的要点。的顺序是很重要的。

The lines are spread out over my code, but this is the gist of it. The order is important.

我还发现,滑动菜单似乎挡住了覆盖模式。我不得不删除为它工作的实例。我仍然在寻找一种方式,使两者叠加模式和滑动菜单。

I also found out that sliding menu seemed to be blocking the overlay mode. I had to remove the instance for it to work. I'm still looking for a way to enable both overlay mode and the sliding menu.

这篇关于使用ActionBarSherlock做动作条覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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