如何使用sherlock lib向右滑动菜单

时间:2014-05-10 07:24:20

标签: android menu actionbarsherlock slide right-to-left

如何使用SherlockLib从右向左滑动菜单? 我将这个tuturial用于幻灯片http://www.androidbegin.com/tutorial/implementing-actionbarsherlock-side-menu-navigation-drawer-in-android/

1 个答案:

答案 0 :(得分:0)

它已经解决了,但没有使用actionbarcomponents。我使用此链接创建完整的右侧或左侧幻灯片菜单。

here

将所有帮助程序类导入到项目后,您可以像这样使用它:

menu2 = new SlidingMenu(this);
        menu2.setShadowWidth(500);
        menu2.setMode(SlidingMenu.RIGHT); // here u can define witch sides
        menu2.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        menu2.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        menu2.setFadeDegree(0.35f);
        menu2.setSlidingEnabled(true);
        menu2.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
        Log.i("SLIDE", "p3");

        LayoutInflater layutInflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View row_menu = layutInflator.inflate(R.layout.layout_menu_main, null, false);



        RelativeLayout r_menu2 = (RelativeLayout) row_menu.findViewById(R.id.menue_item2_relative);
        RelativeLayout r_menu3 = (RelativeLayout) row_menu.findViewById(R.id.menue_item3_relative);
        RelativeLayout r_menu4 = (RelativeLayout) row_menu.findViewById(R.id.menue_item4_relative);
        RelativeLayout r_menu5 = (RelativeLayout) row_menu.findViewById(R.id.menue_item5_relative);
        RelativeLayout r_menu6 = (RelativeLayout) row_menu.findViewById(R.id.menue_item6_relative);


        r_menu2.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {


            }
        });

   // ... code ur jobs on OnClick of items

        menu2.setMenu(row_menu);   

}