如何在ActionBar下设置背景

时间:2013-08-29 09:51:50

标签: android background android-actionbar

我的移动应用程序必须具有所有空间(活动)的背景图像。 ActionBar是透明的,我希望通过ActionBar看到背景图像。 怎么做?

2 个答案:

答案 0 :(得分:0)

我认为你可以通过这样的方式使你的行动栏变得透明:

getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
ActionBar actionBar = getActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#330000ff")));
actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#550000ff")));

答案 1 :(得分:0)

setContentView()调用

之后,在您的活动中添加此单行
getWindow().getDecorView().setBackgroundColor(Color.WHITE)