问题是以下问题:在我的一项活动中,我需要为我的操作栏设置一个自定义布局,而且需要的唯一方法就是在屏幕上显示透明的ActionBar。为此,我将ActionBar标记为叠加,并将操作栏背景指定为透明。这在使用Android> = 15时有效,但在14及以下时,ActionBar会保留其下边框。我试了一下去除它,但没有用。
这是一幅更清晰的图片:
在API 14上:
在API 16上:
设计如下:操作栏应该是透明的并且处于叠加模式,并且在它后面有一个背景+徽标
<ImageView
android:id="@+id/action_bar_background"
android:layout_width="match_parent"
android:layout_height="@dimen/action_bar_accueil_total_height"
android:layout_alignParentTop="true"
android:contentDescription="@string/action_bar"
android:scaleType="fitXY"
android:src="@drawable/actionbar_logo_extended" />
<ImageView
android:id="@+id/home_gallica_logo"
android:layout_width="@dimen/largeur_logo_carrousel"
android:layout_height="@dimen/action_bar_accueil_total_height"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:contentDescription="@string/action_bar"
android:src="@drawable/logo_fullcolor" />
一些精确性:我使用ABS,但这似乎不是问题的根源,因为切换到v7支持库完全一样。
有人知道如何删除这个底部边框吗?
答案 0 :(得分:3)
在评论中按照Luksprog的建议和测试,我在我的操作栏中使用了Theme.Sherlock(而不是Theme.Sherlock.Light),并从我的旧主题复制了设置I需要。这似乎解决了这个问题,但我并不完全确定其来源。我能给那些看到这个的人的唯一建议是使用Theme.Sherlock。
答案 1 :(得分:3)
我试图制作一个simple activity来展示行为,但我没有设法做到这一点。我使用了主题为Activity
的{{1}}:
Theme.Sherlock
并制作叠加层(在android:theme="@style/Theme.Sherlock
方法中):
onCreate()
答案 2 :(得分:0)
您可以通过调用hide()
方法隐藏操作栏:
ActionBar actionBar = getSupportActionBar();
actionBar.hide();
如果您想永久隐藏它,可以在清单中设置:
<activity
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
>