简体   繁体   English

两侧的滑动菜单

[英]Slidingmenu on both sides

I am Completely new to android and i've been given a task of having sliding menus on click of a buttons placed on either side of the corners. 我是android的新手,我已经获得了通过单击位于角落两边的按钮来滑动菜单的任务。 Very similar to that of Facebook app. 与Facebook应用非常相似。 I tried using the SherlockAction bar library and the Slidingmenu library but I don't quite understand its functioning. 我尝试使用SherlockAction酒吧库和Slidingmenu库,但我不太了解它的功能。 Please help me out. 请帮帮我。

Thanks in advance 提前致谢

If you need to use ABS with SlidingMenu first of all go into the SlidingActivities that you plan on using make them extend Sherlock__ Activity instead of _ _Activity. 如果首先需要将ABS与SlidingMenu一起使用,请进入计划使用的SlidingActivities,使它们扩展Sherlock__ Activity而不是_ _Activity。

Then simply try: 然后只需尝试:

public class FragmentsHolderActivity extends SlidingFragmentActivity {

    public static boolean isChangeCategoryAllow = true;
    public static ImageLoader imageLoader = ImageLoader.getInstance();
    public MenuItem mRefreshMenuItem;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);     

        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        final SlidingMenu sm = getSlidingMenu();    
                sm.setFadeEnabled(false);
                sm.setShadowWidthRes(R.dimen.shadow_width);
                sm.setShadowDrawable(R.drawable.shadow);
                sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
                sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);


        // set the Above View
        setContentView(R.layout.content_frame);

         //add if you need dinamically customize your fragment as your liking.
        /*getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.content_frame, new CategoryImagesListFragment())
        .commit();*/

        // set the Behind View
        setBehindContentView(R.layout.menu_frame);

        //add if you need dinamically customize the SlidingMenu as your liking.
        /*getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.menu_frame, new CategoryFragment())
        .commit();  */
    }


    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle presses on the action bar items
        switch (item.getItemId()) {
            case android.R.id.home:
                toggle();
                return true;          
            default:
                return super.onOptionsItemSelected(item);
        }
    }
} 

setBehindContentView will place the view in the "behind" portion of the SlidingMenu. setBehindContentView将视图放置在SlidingMenu的“ behind”部分中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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