Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7794129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:41:50+00:00 2026-06-01T22:41:50+00:00

i use Actionbarsherlock for my App and i like to switch the Actionbar Overlay

  • 0

i use Actionbarsherlock for my App and i like to switch the Actionbar Overlay Mode in my Code.
I have 2 Fragments (one is a Mapview where i want a translucent Actionbar) the other is a ListFragment where a solid Actionbar is needed.

i tryed

requestWindowFeature((int) Window.FEATURE_ACTION_BAR & ~Window.FEATURE_ACTION_BAR_OVERLAY);

problem with this is that requesting Features only works before content is added.

i using this style to accomplish the transparent Actionbar

<style name="TransparentActionbar" parent="@style/Theme.Sherlock" xmlns:android="http://schemas.android.com/apk/res/android">
    <item name="windowActionBarOverlay">true</item>
    <item name="windowActionModeOverlay">true</item>
    <item name="abBackground">#96000000</item>
    <item name="abDivider">@null</item>
</style>

is there a way to set

<item name="windowActionBarOverlay">true</item>
<item name="windowActionModeOverlay">true</item>

to false inside the Activity/Fragment?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:41:51+00:00Added an answer on June 1, 2026 at 10:41 pm

    Edit: Sadly it doesnt work for Actionbarsherlock and a ListFragment from the Compatibility Package.
    Top Margin is added to the Bottom Margin for some reason. Left and Right Margin working fine inside the LayoutListener.

    Found a solution for this Problem in an Android Developer Example

    // Attach a GlobalLayoutListener so that we get a callback when the layout
    // has finished drawing. This is necessary so that we can apply top-margin
    // to the ListView in order to dodge the ActionBar. Ordinarily, that's not
    // necessary, but we've set the ActionBar to "overlay" mode using our theme,
    // so the layout does not account for the action bar position on its own.
    ViewTreeObserver observer = getListView().getViewTreeObserver();
    observer.addOnGlobalLayoutListener(layoutListener);
    
    // Because the fragment doesn't have a reliable callback to notify us when
    // the activity's layout is completely drawn, this OnGlobalLayoutListener provides
    // the necessary callback so we can add top-margin to the ListView in order to dodge
    // the ActionBar. Which is necessary because the ActionBar is in overlay mode, meaning
    // that it will ordinarily sit on top of the activity layout as a top layer and
    // the ActionBar height can vary. Specifically, when on a small/normal size screen,
    // the action bar tabs appear in a second row, making the action bar twice as tall.
    ViewTreeObserver.OnGlobalLayoutListener layoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            int barHeight = getActivity().getActionBar().getHeight();
            ListView listView = getListView();
            FrameLayout.LayoutParams params = (LayoutParams) listView.getLayoutParams();
            // The list view top-margin should always match the action bar height
            if (params.topMargin != barHeight) {
                params.topMargin = barHeight;
                listView.setLayoutParams(params);
            }
            // The action bar doesn't update its height when hidden, so make top-margin zero
            if (!getActivity().getActionBar().isShowing()) {
              params.topMargin = 0;
              listView.setLayoutParams(params);
            }
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use the library ActionBarSherlock in one of my projects, but
I am migrating my code to use Actionbarsherlock. I have made all the code
I want to use ActionBarSherlock and HoloEveryWhere in my Android app but when I
If I use ActionBarSherlock 3.5.1 everything is fine and workes. But if I want
I want to have a toolbar-like menu at the bottom of an activity, and
I'm developing an app for Android 2.2 and higher. I use the great ActionBarSherlock
I'm using the ActionBarSherlock for my application and this is the code I use
I use an ActionBarSherlock library in my app. I also needed to customize the
I have an app that uses ActionBarSherlock to provide a ViewPager control for tab
I am writing an Android app with ActionBar enabled. In my case I use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.