Android-side menu SlidingMenu configuration and use, androidslidingmenu

Source: Internet
Author: User

Android-side menu SlidingMenu configuration and use, androidslidingmenu
Personal blog addressWww.zarezone.cn
Preface

ManyAndroid menuThey all do a very good job, where the number of data used to do more isSide menuNow, for example, CHANGBA, people in the past, of course, there are also many clients that may be used after the revision,SlidingMenuIt is indeed a powerful tool.

Environment Configuration

Many tools have dazzling effects to attract users' attention, but these dazzling effects certainly require some price, that is, the support of a lot of code. This project page is no exception, you may encounter a series of problems when configuring the environment.ProcedureAndPossible problems.

Preparations
  • First download the corresponding dependency project online.GithubThe two projects above, one isSlidingMenuAnd the other isActionBarSherlock. Import these two projects to eclipse. After the SlidingMenu is imported to eclipse, you can get two projects. One isExampleListActivityAnd the other isLibraryThis library is used as the dependent package of the previous project.
  • How can we use one project as the dependency of another project? Right-click the project and select Properties. There isIs LibraryOption. After this option is selected, the project can be used as dependencies of other projects.
  • Then downloadActionBarSherlockThis project is also added to eclipse, and the added project is also configured asLibraryAnd thenExampleListActivity.
Unified dependency and version
  • IfAPI levelIf it is different, an error will be reported during loading. Therefore, you 'd better change the API level of each imported file to the same one.
  • IfAndroid-support-v4.jarIf the version is different, an error is reported. In this case, you need to manually Replace the jar packages of each version with a uniform one.
Modify code
  • Open inLibraryProjectSlidingFragmentActivityThis class, and add the following code to declare this class
1
import com.actionbarsherlock.app.SherlockFragmentActivity;
  • Then replace the code
1
class SlidingFragmentActivity extends FragmentActivity implements SlidingActivityBase
  • Replace it with the following line
1
public class SlidingFragmentActivity extends SherlockFragmentActivity implements SlidingActivityBase
Test

If nothing happens, you can now run the sample program of the side menu. The sample program is just a general outline. You need to adjust the specific configuration manually, the following figure shows an application using SlidingMenu.

Usage

Learning .....

Reference

Now, is it better for android to use the SlidingMenu open-source project to slide the menu bar, or is it better to use the Navigation Drawer that comes with android?

If you are learning the code, it is recommended to study the official version. However, SlidingMenu has many functions, such as controlling the background behind the menu when sliding out. It seems that the background of Navigation Drawer cannot be moved. It is a trend to replace open-source projects with official APIs, because everyone thinks that official interfaces are safe to use, but open-source projects may be more flexible.

Android sliding menu slidingmenu source code can be directly run 349426097 thanks

I uploaded it to the Baidu online storage. Download it by yourself:
Pan.baidu.com/s/1opfZr

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.