简体   繁体   中英

How to make use of the ActionBar Support Libary on Android 2.1

I am stuck at Support Android 2.1 and above section of the Android Developer Guide. http://developer.android.com/training/basics/actionbar/setting-up.html

I tried to extend my MainActivity class with ActionBarActivity just like the guide said. However, it does not exist.

It looks like it is just called ActionBar now. I used the ActionBar import but this caused all my MainActivity methods to go red. I tried removing the @Overrides and fixed some of the error. I still have a number of errors though and I feel like I'm drifting further away.

I pulled back my code to before working on supporting 2.1. I would appreciate it any help trekking this.

For Android 2.1, download the ActionBarSherlock Library by Jake Wharton, and add it to your project:

Simply follow the steps here:

http://www.grokkingandroid.com/adding-actionbarsherlock-to-your-project/

Also take a look here for great examples on how to use the ActionBarSherlock:

https://github.com/JakeWharton/ActionBarSherlock/tree/master/actionbarsherlock-samples

You can also look here of you want to use the official support Library and how to set it up:

http://developer.android.com/tools/support-library/setup.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM