konstantinbueschel
4/15/2014 - 11:39 AM

fix Crouton the ActionBarOverlay problem

fix Crouton the ActionBarOverlay problem

  //change de.keyboardsurfer.android.widget.crouton.Manager class
  
  // add this method below 'handleTranslucentActionBar()' method
  private void handleActionBarOverlay(ViewGroup.MarginLayoutParams params, Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      final boolean flags = activity.getWindow().hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
      if (flags) {
        final int actionBarContainerId = Resources.getSystem().getIdentifier("action_bar_container", "id", "android");
        final View actionBarContainer = activity.findViewById(actionBarContainerId);
        // The action bar is present: the app is using a Holo theme.
        if (actionBarContainer != null) {
          final ViewGroup.MarginLayoutParams marginParams = (ViewGroup.MarginLayoutParams) params;
          marginParams.topMargin = actionBarContainer.getBottom();
        }
      }
    }
  }
  
  //add call the method(below handleTranslucentActionBar call position):
        handleTranslucentActionBar((ViewGroup.MarginLayoutParams) params, activity);
        handleActionBarOverlay((ViewGroup.MarginLayoutParams) params, activity);