Recently doing a thing, and then asked to be compatible with more than 2.3 mobile phone (this request is really egg, now charge the phone system is 4.0.3) plus the need for the effect of the drawer and Google's drawer style is not the same, helpless under, can only use the Open Source Library to re-write, Search the Internet, we recommend the use of Actionbarsherlock+slidingmenu combination, I tried a bit under
First, download the two open source projects and attach
Actionbarsherlock:http://actionbarsherlock.com/download.html
Slidingmenu:https://github.com/jfeinstein10/slidingmenu
Unzip open after download
The two folders I marked with the red line are for this one.
Create a new project called Actionbarsherlocklibrary in Eclipse, tick the mark this project as a library option in the second section, then all the way next, after the project is built
Copy the contents of the Actionbarsherlock into the Actionbarsherlocklibrary project, all covered, there will be duplicate files, pay attention to choose Replace All, in Eclipse right-click->refresh
Similarly, build a project called Slidingmenulibrary, do the same, and then refresh.
This step is important to put your purpose project (you want to use Slidingmenu's Sherlockavtionbar project), actionbarsherlocklibrary,slidingmenulibrary three projects in use
Android-support-v4.jar must be the same, or it will be an error, simply copy and paste the replacement can be
In your Slidingmenulibrary project, right-->properties->android The library view below select Add Actionbarsherlocklibrary,
And put the slidingfragmentactivity inside the com.jeremyfeinstein.slidingmenu.lib.app inside.
1 PublicclassSlidingfragmentactivityextendsFragmentactivityImplementsSlidingactivitybase
Replaced by
1 Public classSlidingfragmentactivityextendsSherlockfragmentactivityImplementsSlidingactivitybase
then put Com.jeremyfeinstein.slidingmenu.lib.app inside. slidinglistactivity inside the
1 Public class Slidinglistactivity extends Listactivity implementsSlidingactivitybase
Replaced by
1Public class Slidinglistactivity extends Sherlocklistactivity implementsSlidingactivitybase
then put Com.jeremyfeinstein.slidingmenu.lib.app inside. slidingpreferenceactivity inside the
1 Public class Slidingpreferenceactivity extends Preferenceactivityimplements Slidingactivitybase
Replaced by
1Public class Slidingpreferenceactivity extends Sherlockpreferenceactivityimplements Slidingactivitybase
Then, in your goal project right-->properties inside and in front of the same method, import two projects, you can, normal use of two open source Library
In use, you use Actionbarsherlock's activity to change the integrated class to sherlockactivity
and using the method when instantiating Actionbar
Maction = Getsupportactionbar ();
The other way is basically the same, is to pay attention to your activity in the menu and MenuItem method to use
Import Com.actionbarsherlock.view.menu;import Com.actionbarsherlock.view.MenuItem;
Two packages inside the method
1menu =NewSlidingmenu ( This);
2//Instantiate Slidingmenu
3Menu.setmode (Slidingmenu.left);
4//set the slide direction of the Slidingmenu, with Left,right,left_rightMenu.settouchmodeabove (slidingmenu.touchmode_fullscreen);
5//set the active slide-out touch position of the Slidingmenu6Menu.setbehindwidth (Getresources (). Getdimensionpixelsize (
7R.dimen.menu_width));
8//sets the width of the slide out of the Slidingmenu
9Menu.attachtoactivity (act_commdotitylist. This,
TenSlidingmenu.sliding_window);
One//Bar Slidingmenu Add to activity
A//Setting the slide-out range of the Slidingmenu
-//Sliding_window slide out area for entire screen
-//sliding_content only slide out of the area below Actionbar
theMenu.setmenu (R.layout.sliding_menu);
- // add slidingmenu layout file
This article first came here, I still need to further study the rest, but the use of Sherlockactionbar and Actionbar method is basically the same, so I believe that everyone will use