Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

Overlapping tab navigation and ActionMode #1059

Open
giuseppe83ac opened this issue Oct 29, 2013 · 0 comments
Open

Overlapping tab navigation and ActionMode #1059

giuseppe83ac opened this issue Oct 29, 2013 · 0 comments

Comments

@giuseppe83ac
Copy link

Hi

I have a strange problem with ActionBarSherlock, using tab navigation and an Action Mode I obtain an overlapping between these elments.

I repeat the problem simply extend the project "TabNavigation" in demo sample, obtaining this:

  1. Application start (portrait mode) and it works correctly;
    1
  2. I rotate application and it works correctly;
    2
  3. I rotate again application and now tab navigation and ActionMode are overlapped.
    3

Code works correctly on Android 4.0 (tested on real device and emulator), but on Jelly Bean (tested only on emulator) I have the previously behavior.
Sometimes (but rarely), all works perfectly, especially if I have all animations enable in Dev. Setting (usually I disable all animations).

I'm using ActionBarSherlock 4.4.

The example code is the follow:

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.app.ActionBar.Tab;
import com.actionbarsherlock.view.ActionMode;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;

public class MainActivity extends SherlockFragmentActivity implements ActionBar.TabListener {
    private ActionMode actionMode = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        setTheme(com.actionbarsherlock.R.style.Theme_Sherlock);
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        for (int i = 1; i <= 2; i++) {
            ActionBar.Tab tab = getSupportActionBar().newTab();
            tab.setText("Tab " + i);
            tab.setTabListener(this);
            getSupportActionBar().addTab(tab);
        }

        actionMode = startActionMode(new TestActionMode());
    }

    @Override
    public void onTabSelected(Tab tab, FragmentTransaction ft)  { /* TODO Auto-generated method stub */ }

    @Override
    public void onTabUnselected(Tab tab, FragmentTransaction ft)  { /* TODO Auto-generated method stub */ }

    @Override
    public void onTabReselected(Tab tab, FragmentTransaction ft)  { /* TODO Auto-generated method stub */ }


    private final class TestActionMode implements ActionMode.Callback {

        @Override
        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            menu.add("Add").setIcon(android.R.drawable.ic_input_add).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
            menu.add("Search").setIcon(android.R.drawable.ic_search_category_default).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

            return true;
        }

        @Override
        public boolean onPrepareActionMode(ActionMode mode, Menu menu) { /* TODO Auto-generated method stub */ return false; }

        @Override
        public boolean onActionItemClicked(ActionMode mode, MenuItem item) { /* TODO Auto-generated method stub */ return false; }

        @Override
        public void onDestroyActionMode(ActionMode mode) { /* TODO Auto-generated method stub */ }
    }

}

Has anyone similar problem? Is there any solution or workaround for that?

Regards,
Giuseppe

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant