コード例 #1
0
        private void setUpMenu()
        {

            // attach to current activity;
            resideMenu = new RResideMenu(this);
            resideMenu.setUse3D(true);
            resideMenu.setBackground(R.Drawable.menu_background);
            resideMenu.attachToActivity(this);
            resideMenu.setMenuListener(this);
            //valid scale factor is between 0.0f and 1.0f. leftmenu'width is 150dip. 
            resideMenu.setScaleValue(0.6f);

            // create menu items;
            itemHome = new ResideMenuItem(this, R.Drawable.icon_home, "Home");
            itemProfile = new ResideMenuItem(this, R.Drawable.icon_profile, "Profile");
            itemCalendar = new ResideMenuItem(this, R.Drawable.icon_calendar, "Calendar");
            itemSettings = new ResideMenuItem(this, R.Drawable.icon_settings, "Settings");

            itemHome.SetOnClickListener(this);
            itemProfile.SetOnClickListener(this);
            itemCalendar.SetOnClickListener(this);
            itemSettings.SetOnClickListener(this);

            resideMenu.addMenuItem(itemHome, RResideMenu.DIRECTION_LEFT);
            resideMenu.addMenuItem(itemProfile, RResideMenu.DIRECTION_LEFT);
            resideMenu.addMenuItem(itemCalendar, RResideMenu.DIRECTION_RIGHT);
            resideMenu.addMenuItem(itemSettings, RResideMenu.DIRECTION_RIGHT);

            // You can disable a direction by setting ->
            // resideMenu.setSwipeDirectionDisable(ResideMenu.DIRECTION_RIGHT);

            //FindViewById(R.id.title_bar_left_menu).setOnClickListener(new View.OnClickListener() {
            //    @Override
            //    public void onClick(View view) {
            //        resideMenu.openMenu(ResideMenu.DIRECTION_LEFT);
            //    }
            //});
            FindViewById(R.Id.title_bar_left_menu).Click += delegate
            {
                resideMenu.openMenu(RResideMenu.DIRECTION_LEFT);
            };

            //findViewById(R.id.title_bar_right_menu).setOnClickListener(new View.OnClickListener() {
            //    @Override
            //    public void onClick(View view) {
            //        resideMenu.openMenu(ResideMenu.DIRECTION_RIGHT);
            //    }
            //});
            FindViewById(R.Id.title_bar_right_menu).Click += delegate
            {
                resideMenu.openMenu(RResideMenu.DIRECTION_RIGHT);
            };
        }
コード例 #2
0
 /**
  * Add a single items;
  *
  * @param menuItem
  * @param direction
  */
 public void addMenuItem(ResideMenuItem menuItem, int direction)
 {
     if (direction == DIRECTION_LEFT)
     {
         this.leftMenuItems.Add(menuItem);
         layoutLeftMenu.AddView(menuItem);
     }
     else
     {
         this.rightMenuItems.Add(menuItem);
         layoutRightMenu.AddView(menuItem);
     }
 }
コード例 #3
0
        /**
         * Add a single item to the left menu;
         *
         * WARNING: It will be removed from v2.0.
         * @param menuItem
         */
        //@Deprecated

        public void addMenuItem(ResideMenuItem menuItem)
        {
            this.leftMenuItems.Add(menuItem);
            layoutLeftMenu.AddView(menuItem);
        }