Last active
August 29, 2015 13:57
-
-
Save khris/9801921 to your computer and use it in GitHub Desktop.
Hack ActionBar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
View decorView = getWindow().getDecorView(); | |
int actionBarViewId = decorView.getContext().getResources().getIdentifier("android:id/action_bar", null, null); | |
View actionBarView = getWindow().getDecorView().findViewById(actionBarViewId); | |
actionBarView.setClickable(true); | |
actionBarView.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
Toast.makeText(v.getContext(), "ActionBar is clicked", Toast.LENGTH_LONG).show(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's only tested on Android SDK, not AppCompat and other libs that mimics
ActionBar
.