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

Custom ActionView can't be clicked in 3.5.0 release #131

Closed
ai212983 opened this issue Dec 22, 2011 · 7 comments
Closed

Custom ActionView can't be clicked in 3.5.0 release #131

ai212983 opened this issue Dec 22, 2011 · 7 comments

Comments

@ai212983
Copy link

Just noticed - with 3.5.0 version I can't click custom ActionView:

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main_menu, menu);

        MenuItem checkout = menu.findItem(R.id.menu_checkout);

        mCheckoutView = new ActionBarCheckoutView(this);
        checkout.setActionView(mCheckoutView);

        return super.onCreateOptionsMenu(menu);
    }

ActionBarCheckoutView is just a subclass of LinearLayout containing image and some text field. Its not clickable with latest version. In previous version everything was fine.

@ai212983
Copy link
Author

Moreover, it has no separator now... I guess something is wrong with MenuItem.setActionView logic.

@ai212983
Copy link
Author

Any chance this bug will be fixed / looked into (or at least this issue commented) any time soon?

Looks like showstopper severity to me. Maybe custom action views aren't used in many projects, but if they ARE used, 3.5.0 breaks project completely.

@JakeWharton
Copy link
Owner

Separator logic was changed to match ICS. Looking into this now...

@ai212983
Copy link
Author

It's not working with both pre-ICS (Nexus S 2.2.3) and ICS (Galaxy Nexus 4.0.1) devices, btw.

@JakeWharton
Copy link
Owner

Yeah I just added a demo for it. It appears you have to handle clicks yourself on 4.0+ and since ABS 3.5's action menu is ported from the ICS it behaves the same.

@ai212983
Copy link
Author

Not sure how it will work on 4.0+, but I wasn't able to capture click event on pre-ICS device for some reason, making the whole idea of using custom action views in ABS meaningless. Besides, separators are still bugged. I guess the best idea would be to avoid custom action views at all...

Will look into your demo though, thanks.

@JakeWharton
Copy link
Owner

The action menu will place a divider before an action item if the previous action item is non-custom and has text or if the current item is non-custom and has both text and an icon.

See this and this for the code.

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

2 participants