Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionBar border won't go away when in overlay

The problem is the following one : on one of my activities, I needed a custom layout for my action bar, and the only way to do it like needed was to have a transparent ActionBar over my screen. In order to do that, I marked the ActionBar as overlay, and specified the action bar background as transparent. This works when using Android >= 15, but in 14 and below, the ActionBar keeps its bottom border. I tried anything to remove it, with no avail.

Here is a picture to see it more clearly :

On API 14 : ActionBar on API 14

On API 16: ActionBar on API 16

The design is the following : the Action Bar is supposed to be transparent and in overlay mode, and behind it there is a background + the logo

<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" />

Some precisions : I use ABS, but this does not seem to be the source of the problem, as switching to the v7 support library did exactly the same thing.

Do anyone has an idea how to remove this bottom border ?

like image 438
Valentin Rocher Avatar asked Aug 06 '13 14:08

Valentin Rocher


2 Answers

Following the advice and the test by Luksprog in the comment, I used Theme.Sherlock (instead of Theme.Sherlock.Light) in my action bar for this page, and copied from my old theme the settings I needed. This seems to have resolved the problem, but I'm not completely sure of the source. The only advice I can give to people who are going to see this will be to use Theme.Sherlock.

like image 138
Valentin Rocher Avatar answered Nov 21 '22 18:11

Valentin Rocher


I've tried to make a simple activity to showcase the behavior but I didn't manage to do it. I used an Activity with the theme Theme.Sherlock:

android:theme="@style/Theme.Sherlock

and to make the overlay(in the onCreate() method):

requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); // Window from com.actionbarsherlock.view
//...
setContentView(content);
ActionBar ab = getSupportActionBar();
ab.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
like image 40
user Avatar answered Nov 21 '22 20:11

user