Skip to content

Instantly share code, notes, and snippets.

@khris khris/gist:9801921
Last active Aug 29, 2015

What would you like to do?
Hack ActionBar
View decorView = getWindow().getDecorView();
int actionBarViewId = decorView.getContext().getResources().getIdentifier("android:id/action_bar", null, null);
View actionBarView = getWindow().getDecorView().findViewById(actionBarViewId);
actionBarView.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Toast.makeText(v.getContext(), "ActionBar is clicked", Toast.LENGTH_LONG).show();

This comment has been minimized.

Copy link
Owner Author

khris commented Mar 27, 2014

It's only tested on Android SDK, not AppCompat and other libs that mimics ActionBar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.