當前位置: 首頁>>代碼示例>>Java>>正文


Java SlidingMenu類代碼示例

本文整理匯總了Java中com.jeremyfeinstein.slidingmenu.lib.SlidingMenu的典型用法代碼示例。如果您正苦於以下問題:Java SlidingMenu類的具體用法?Java SlidingMenu怎麽用?Java SlidingMenu使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SlidingMenu類屬於com.jeremyfeinstein.slidingmenu.lib包,在下文中一共展示了SlidingMenu類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: preSetup

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
private void preSetup()
{
    setBehindContentView(R.layout.chatroom_slideout);
    mChatroomSlidingMenu = getSlidingMenu();

    mChatroomSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
    mChatroomSlidingMenu.setShadowWidthRes(R.dimen.shadow_width);
    mChatroomSlidingMenu.setShadowDrawable(new ColorDrawable(getResources().getColor(R.color.transparentGrey)));
    mChatroomSlidingMenu.setBehindWidthRes(R.dimen.sliding_menu_chats_width);
    mChatroomSlidingMenu.setFadeDegree(0.35f);

    mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
    mEditor = mSharedPrefs.edit();
    mEditor.apply();
    mFragmentManager = getSupportFragmentManager();

    mIntent = getIntent();
}
 
開發者ID:HueToYou,項目名稱:ChatExchange-old,代碼行數:19,代碼來源:MainActivity.java

示例2: createUsersSlidingMenu

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
/**
 * Setup current users {@link SlidingMenu}
 */

private void createUsersSlidingMenu()
{
    // configure the SlidingMenu
    mCurrentUsers_SlidingMenu = new SlidingMenu(MainActivity.this);
    mCurrentUsers_SlidingMenu.setMode(SlidingMenu.RIGHT);
    //mCurrentUsers_SlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
    mCurrentUsers_SlidingMenu.setShadowWidthRes(R.dimen.shadow_width);
    mCurrentUsers_SlidingMenu.setShadowDrawable(new ColorDrawable(getResources().getColor(R.color.transparentGrey)));
    mCurrentUsers_SlidingMenu.setBehindWidthRes(R.dimen.sliding_menu_width);
    mCurrentUsers_SlidingMenu.setFadeDegree(0.35f);
    mCurrentUsers_SlidingMenu.attachToActivity(MainActivity.this, SlidingMenu.SLIDING_CONTENT);
    mCurrentUsers_SlidingMenu.setMenu(R.layout.users_slideout);
    mCurrentUsers_SlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
    mCurrentUsers_SlidingMenu.setOnOpenedListener(new SlidingMenu.OnOpenedListener()
    {
        @Override
        public void onOpened()
        {
            TutorialStuff.showUsersTutorial(MainActivity.this);
        }
    });
}
 
開發者ID:HueToYou,項目名稱:ChatExchange-old,代碼行數:27,代碼來源:MainActivity.java

示例3: startSlideMenu

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
/**
 * @brief Starts the SlideMenu
 * @details Starts the SlideMenu. Sets all the configurations
 */
private void startSlideMenu(){
       // configure the SlidingMenu
       //para modificar el margen de dips cambiar MARGIN_THRESHOLD en la 
	//clase CustomViewBehind de la slideLibrary (antes a 48, bajado a 28).
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
	menu.setShadowWidthRes(R.dimen.shadow_width);
	menu.setShadowDrawable(R.drawable.shadow);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	
	menu.setMenu(R.layout.menu_frame);		
	
	//lista lateral con el menu
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.menu_frame, new SlideListFragment())
	.commit();
}
 
開發者ID:CodyyAndroid,項目名稱:LibVNCAndroid,代碼行數:24,代碼來源:CanvasActivity.java

示例4: onCreate

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	//ȥ��������,������setContentView֮ǰ����
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	setContentView(R.layout.activity_main);
	
	//�����
       setBehindContentView(R.layout.left_menu);
       SlidingMenu slidingMenu = getSlidingMenu();
       //����ȫ��������ʾ�����
       slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
       //������ĻԤ�����
       WindowManager wm = this.getWindowManager();
       int width = wm.getDefaultDisplay().getWidth();
       slidingMenu.setBehindOffset(width*3/5);
       
       initFragment();
}
 
開發者ID:unique5954,項目名稱:zhbj74,代碼行數:20,代碼來源:MainActivity.java

示例5: initSlideMenu

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
private void initSlideMenu() {
        setBehindContentView(R.layout.menu_home);
        //獲取到slidingMenu對象
        SlidingMenu slidingMenu = getSlidingMenu();
        slidingMenu.setMode(SlidingMenu.RIGHT);
        slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
        slidingMenu.setShadowDrawable(R.drawable.shadow);

        //設置為全屏拉出菜單
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        //設置菜單拉出後剩餘屏幕寬度
//讓側拉菜單充滿屏幕的四分之三
        int menuWidth=getWitdh();
        slidingMenu.setBehindOffset(menuWidth);
        slidingMenu.setOnCloseListener(new SlidingMenu.OnCloseListener() {
            @Override
            public void onClose() {
                Log.d("changecity", "菜單關閉");
                mFragWether.refreshData();
                mFragSlideMenu.stopAlarmMusic();
            }
        });
    }
 
開發者ID:JoeSteven,項目名稱:Moring-Alarm,代碼行數:24,代碼來源:HomeActivity.java

示例6: onCreate

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	getSlidingMenu().setMode(SlidingMenu.LEFT_RIGHT);
	getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	
	setContentView(R.layout.content_frame);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.content_frame, new SampleListFragment())
	.commit();
	
	getSlidingMenu().setSecondaryMenu(R.layout.menu_frame_two);
	getSlidingMenu().setSecondaryShadowDrawable(R.drawable.shadowright);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.menu_frame_two, new SampleListFragment())
	.commit();
}
 
開發者ID:JoeSteven,項目名稱:Moring-Alarm,代碼行數:20,代碼來源:LeftAndRightActivity.java

示例7: onCreate

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	// set the Above View
	if (savedInstanceState != null)
		mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
	if (mContent == null)
		mContent = new ColorFragment(R.color.red);	
	
	// set the Above View
	setContentView(R.layout.content_frame);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.content_frame, mContent)
	.commit();
	
	// set the Behind View
	setBehindContentView(R.layout.menu_frame);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.menu_frame, new ColorMenuFragment())
	.commit();
	
	// customize the SlidingMenu
	getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
}
 
開發者ID:JoeSteven,項目名稱:Moring-Alarm,代碼行數:27,代碼來源:FragmentChangeActivity.java

示例8: initMenu

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
private void initMenu() {
	SlidingMenu menu = getSlidingMenu();
	//����ͨ������
	menu.setMode(SlidingMenu.LEFT_RIGHT);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
	menu.setShadowWidthRes(R.dimen.shadow_width);
	menu.setShadowDrawable(R.drawable.shadow);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);

	//���IJ˵�
	setBehindContentView(R.layout.menu_left);//���Ҳ಻��ʹ��ͬһ�����֣�����replace���Ŀؼ���ID������ͬ����֪��Ϊʲô�������������
	Fragment leftMenuFragment = new MainTabFragment2("���˵�");
	getSupportFragmentManager().beginTransaction().replace(R.id.menu_left, leftMenuFragment).commit();

	//�Ҳ�˵�����
	menu.setSecondaryShadowDrawable(R.drawable.shadow);//������Դ�ļ�ID�������ұߣ������������˵�����ӰЧ��
	menu.setSecondaryMenu(R.layout.menu_right);//�����ұ߲໬�˵�
	Fragment rightMenuFragment = new MainTabFragment2("�Ҳ�˵�");
	getSupportFragmentManager().beginTransaction().replace(R.id.menu_right, rightMenuFragment).commit();
}
 
開發者ID:baiqiantao,項目名稱:MainUI,代碼行數:22,代碼來源:MainActivity3.java

示例9: onCreate

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);
        setBehindContentView(R.layout.left_menu);// 設置側邊欄
        SlidingMenu slidingMenu = getSlidingMenu();//獲取側邊欄對象
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);// 設置全屏觸摸
        slidingMenu.setBehindOffset(280);// 設置預留屏幕的寬度

//        setBehindContentView(R.layout.left_menu);// 設置側邊欄布局
//
//        SlidingMenu slidingMenu = getSlidingMenu();// 獲取側邊欄對象
//        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);// 設置全屏觸摸
//
//        slidingMenu.setSecondaryMenu(R.layout.right_menu);// 設置右側邊欄
//        slidingMenu.setMode(SlidingMenu.LEFT_RIGHT);// 設置展現模式
//
//        slidingMenu.setBehindOffset(100);// 設置預留屏幕的寬度

        initFragment();

    }
 
開發者ID:FireB1ack,項目名稱:ZhiHuiBeiJing,代碼行數:24,代碼來源:MainActivity.java

示例10: onOptionsItemSelected

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
		case android.R.id.home:
			SlidingMenu sm = getSlidingMenu();
			if (sm.isMenuShowing())
				sm.showContent();
			else
				sm.showMenu();
			return true;
		case R.id.menu_about:
			aboutDialog.show();
			return true;
		//case R.id.menu_calendar_view:
		default:
            return super.onOptionsItemSelected(item);
	}
}
 
開發者ID:danielebufarini,項目名稱:Reminders,代碼行數:19,代碼來源:Reminders.java

示例11: initSlidingMenu

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
public void initSlidingMenu(){
    leftMenu=getSlidingMenu();
    leftMenu.setMode(SlidingMenu.LEFT);
    leftMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
    leftMenu.setShadowWidthRes(R.dimen.shadow_width);
    leftMenu.setShadowDrawable(R.drawable.shadow);
    leftMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    leftMenu.setFadeDegree(0.35f);

    FragmentTransaction fragmentTransaction=getSupportFragmentManager().beginTransaction();
    fragmentTransaction.replace(R.id.left_menu,new MenuFragment());
    //fragmentTransaction.replace(R.id.content,new HomeFragment());

    fragmentTransaction.commit();

    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);
}
 
開發者ID:emgroves,項目名稱:ECC-Android,代碼行數:19,代碼來源:MainActivity.java

示例12: onCreate

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // configure the SlidingMenu
    SlidingMenu menu = new SlidingMenu(this);
    menu.setMode(SlidingMenu.LEFT);
    // 設置觸摸屏幕的模式
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
    menu.setShadowWidthRes(R.dimen.shadow_width);
    menu.setShadowDrawable(R.color.colorPrimary);

    // 設置滑動菜單視圖的寬度
    menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    // 設置漸入漸出效果的值
    menu.setFadeDegree(0.35f);
    /**
     * SLIDING_WINDOW will include the Title/ActionBar in the content
     * section of the SlidingMenu, while SLIDING_CONTENT does not.
     */
    menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    //為側滑菜單設置布局
    menu.setMenu(R.layout.layout_left_menu);
}
 
開發者ID:hongyang51,項目名稱:SlidingMenu4Studio,代碼行數:25,代碼來源:MainActivity.java

示例13: initSlidingMenu

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
private void initSlidingMenu() {
		// TODO Auto-generated method stub
		
			try {
				sm = getSlidingMenu();
				
				sm.setMode(SlidingMenu.LEFT_RIGHT);//�������һ��˵�
				sm.setSecondaryMenu(R.layout.right);
				
				sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);//����Ҫʹ�˵�������������Ļ�ķ�Χ
				sm.setTouchModeBehind(SlidingMenu.TOUCHMODE_FULLSCREEN);
				sm.getMenu().setFocusable(false);
				sm.setShadowWidthRes(R.dimen.shadow_width);//������ӰͼƬ�Ŀ��
				sm.setShadowDrawable(R.drawable.shadow);//������ӰͼƬ
				sm.setFadeDegree(0.35F);//SlidingMenu����ʱ�Ľ���̶�
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
				
			
			
		
//		sm.bringToFront();
		
	}
 
開發者ID:lnfscj,項目名稱:webbroserBaiDu,代碼行數:27,代碼來源:MainActivity.java

示例14: initSlidingMenu

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
private void initSlidingMenu(Bundle savedInstanceState) {
    // check if the content frame contains the menu frame
    if (findViewById(R.id.menu_frame) == null) {
        setBehindContentView(R.layout.menu_frame);
        getSlidingMenu().setSlidingEnabled(true);
        getSlidingMenu()
                .setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    } else {
        // add a dummy view
        View v = new View(this);
        setBehindContentView(v);
        getSlidingMenu().setSlidingEnabled(false);
        getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
    }

    // 設置主界麵Fragment視圖內容
    if (savedInstanceState != null)
        mContent = getSupportFragmentManager().getFragment(
                savedInstanceState, "mContent");
    if (mContent == null)
        mContent = new GlanceMainFragment();

    getSupportFragmentManager().beginTransaction()
            .replace(R.id.content_frame, mContent).commit();

    // set the Behind View Fragment
    getSupportFragmentManager().beginTransaction()
            .replace(R.id.menu_frame, new MainMenuFragment()).commit();

    // 設置滑動菜單的屬性值
    SlidingMenu sm = getSlidingMenu();
    sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowDrawable(R.drawable.shadow);
    sm.setBehindScrollScale(0.25f);
    sm.setFadeDegree(0.25f);
}
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:38,代碼來源:SlidingMenuMainActivity.java

示例15: onPostCreate

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //導入依賴的package包/類
/**
 * Further SlidingMenu initialization. Should be called within the activitiy's onPostCreate()
 *
 * @param savedInstanceState the saved instance state (unused)
 */
public void onPostCreate(Bundle savedInstanceState) {
	if (mViewBehind == null || mViewAbove == null) {
		throw new IllegalStateException("Both setBehindContentView must be called " +
				"in onCreate in addition to setContentView.");
	}

	mOnPostCreateCalled = true;

	mSlidingMenu.attachToActivity(mActivity, 
			mEnableSlide ? SlidingMenu.SLIDING_WINDOW : SlidingMenu.SLIDING_CONTENT);
	
	final boolean open;
	final boolean secondary;
	if (savedInstanceState != null) {
		open = savedInstanceState.getBoolean("SlidingActivityHelper.open");
		secondary = savedInstanceState.getBoolean("SlidingActivityHelper.secondary");
	} else {
		open = false;
		secondary = false;
	}
	new Handler().post(new Runnable() {
		public void run() {
			if (open) {
				if (secondary) {
					mSlidingMenu.showSecondaryMenu(false);
				} else {
					mSlidingMenu.showMenu(false);
				}
			} else {
				mSlidingMenu.showContent(false);					
			}
		}
	});
}
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:40,代碼來源:SlidingActivityHelper.java


注:本文中的com.jeremyfeinstein.slidingmenu.lib.SlidingMenu類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。