Is there action bar for Android Level 7 or something else that I can use as action bar? I need to build an app whi开发者_StackOverflow社区ch is using action bar for Android 2.1
JohanNilsson has actually created a ActionBar
library which is available on GitHub.
Direct link.
here you go. The officle android article is called: ActionBarCompat - Action Bar Compatibility. (just in case the link wont work for ever)
Well, you should try this open source project http://actionbarsherlock.com , you will find it's full definition on this website In the newest version it will have support for features provided by ICS.
TypedArray a = mActivity.getTheme().obtainStyledAttributes(R.style.AppTheme, new int[] {
R.attr.actionbarCompatItemHomeStyle,
R.attr.actionbarCompatItemStyle
});
int actionbarCompatItemHomeStyle = a.getResourceId(0, 0);
int actionbarCompatItemStyle = a.getResourceId(1, 0);
ImageButton actionButton = new ImageButton(mActivity, null,
itemId == android.R.id.home ? actionbarCompatItemHomeStyle : actionbarCompatItemStyle
);
The equivalent of action bar in pre-Honeycomb versions of Android is the options menu, accessible under Menu button.
In July 2013 Google added action bar compatibility back to 2.1 (7+) in New "v7 appcompat library"
http://developer.android.com/tools/support-library/index.html
精彩评论