当前位置: 首页>>代码示例>>Java>>正文


Java SlidingMenu.attachToActivity方法代码示例

本文整理汇总了Java中com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.attachToActivity方法的典型用法代码示例。如果您正苦于以下问题:Java SlidingMenu.attachToActivity方法的具体用法?Java SlidingMenu.attachToActivity怎么用?Java SlidingMenu.attachToActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jeremyfeinstein.slidingmenu.lib.SlidingMenu的用法示例。


在下文中一共展示了SlidingMenu.attachToActivity方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: prepareMenu

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
/**
 * 准备侧滑菜单
 */
private void prepareMenu() {
    mSlidingMenu = new SlidingMenu(mContext);
    mSlidingMenu.setMode(SlidingMenu.LEFT);
    mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
    mSlidingMenu.setShadowWidth(0);
    mSlidingMenu.setBehindOffset((int) (SizeUtils.getScreenWidthPx(mContext) * 0.5));
    mSlidingMenu.setFadeDegree(0.0f);
    mSlidingMenu.setBehindScrollScale(0.0f);
    mSlidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);

    // 为侧滑菜单设置布局
    View view = View.inflate(mContext, R.layout.slidingmenu_profile, null);
    mSlidingMenu.setMenu(view);

    mPortraitView = view.findViewById(R.id.ll_slidingmenu_profile_portrait_layout);
    mPortraitImageView = (SimpleDraweeView) view.findViewById(R.id.sdv_slidingmenu_profile_portrait_image);
    mNicknameTextView = (TextView) view.findViewById(R.id.tv_slidingmenu_profile_nickname);
    mCollectionView = view.findViewById(R.id.rl_slidingmenu_profile_collection_layout);
    mCommentView = view.findViewById(R.id.rl_slidingmenu_profile_comment_layout);
    mClearCacheView = view.findViewById(R.id.rl_slidingmenu_profile_clear_cache_layout);
    mChangModeView = view.findViewById(R.id.rl_slidingmenu_profile_change_mode_layout);
    mFeedbackView = view.findViewById(R.id.rl_slidingmenu_profile_feekback_layout);
    mCommendView = view.findViewById(R.id.rl_slidingmenu_profile_commend_layout);
    mAboutView = view.findViewById(R.id.rl_slidingmenu_profile_aboutme_layout);

    mPortraitView.setOnClickListener(this);
    mCollectionView.setOnClickListener(this);
    mCommentView.setOnClickListener(this);
    mClearCacheView.setOnClickListener(this);
    mChangModeView.setOnClickListener(this);
    mFeedbackView.setOnClickListener(this);
    mCommendView.setOnClickListener(this);
    mAboutView.setOnClickListener(this);

}
 
开发者ID:6ag,项目名称:LiuAGeAndroid,代码行数:39,代码来源:MainActivity.java

示例4: setSlidingMenu

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
private void setSlidingMenu() {
    menu = new SlidingMenu(this);
    menu.setMode(SlidingMenu.LEFT);
    // 设置触摸屏幕的模式
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.setBehindScrollScale(1.0f);
    // 设置滑动菜单视图的宽度
    menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    // 设置渐入渐出效果的值
    menu.setFadeDegree(0);
    menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    //为侧滑菜单设置布局
    menu.setMenu(menuView);
}
 
开发者ID:ChenTianSaber,项目名称:DailyZhiHu,代码行数:15,代码来源:HomePagerActivity.java

示例5: initSlidingMenu

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
private void initSlidingMenu() {
    slidingMenu = new SlidingMenu(this);
    slidingMenu.setMode(SlidingMenu.LEFT); //侧边栏从哪边出
    slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);//从哪边可以拖动,fullscreen表示全屏都可以拖动,margin表示一定区域内可拖动
    slidingMenu.setBehindOffset(200);//菜单弹出后内容显示多少
    slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    slidingMenu.setMenu(R.layout.menu_sliding_layout);
}
 
开发者ID:ting4937,项目名称:AndroidUtils,代码行数:9,代码来源:MainActivity.java

示例6: onCreate

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	setTitle(R.string.attach);

	// set the Above View
	setContentView(R.layout.content_frame);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.content_frame, new SampleListFragment())
	.commit();

	// configure the SlidingMenu
	menu = new SlidingMenu(this);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	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);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.menu_frame, new SampleListFragment())
	.commit();
}
 
开发者ID:JoeSteven,项目名称:Moring-Alarm,代码行数:28,代码来源:AttachExample.java

示例7: setupSlideMenu

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
private void setupSlideMenu() {
    DisplayMetrics metric = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metric);
    int width = metric.widthPixels;
    mSlidingMenu = new SlidingMenu(this);
    mSlidingMenu.setMode(SlidingMenu.LEFT);
    mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
    mSlidingMenu.setBehindOffset(width * 3 / 5);
    mSlidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    mSlidingMenu.setMenu(R.layout.menu);
    mSlidingMenu.setOnCloseListener(new SlidingMenu.OnCloseListener() {
        @Override
        public void onClose() {
            dismissInputMethod();
        }
    });
    UserInfo userInfo = UserInfo.getInstance();
    boolean isLoggedIn = false;
    if(TextUtils.isEmpty(userInfo.getUsername())) {
        mLoginManager = new LoginManager(this, LoginStatus.NOTREGISTERED);
    } else if(TextUtils.isEmpty(userInfo.getToken())) {
        mLoginManager = new LoginManager(this, LoginStatus.LOGGEDOUT);
    } else {
        mLoginManager = new LoginManager(this, LoginStatus.LOGEDIN);
        isLoggedIn = true;
    }
    mLoginManager.show(getSupportFragmentManager(), R.id.menu_container);
    if(!isLoggedIn) {
        mSlidingMenu.showMenu();
    }
}
 
开发者ID:shawnchain,项目名称:mclub-tracker-app,代码行数:32,代码来源:LocationActivity.java

示例8: onCreate

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_home);
    mTitle = getTitle();

    /* sliding menu with both right and left drawer */
    slidingMenu = new SlidingMenu(this);
    slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
    slidingMenu.setShadowDrawable(R.drawable.shadow);
    slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    slidingMenu.setFadeDegree(0.35f);
    slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    slidingMenu.setMode(SlidingMenu.LEFT_RIGHT);
    slidingMenu.setMenu(R.layout.slidingmenu_navigation_drawer);
    slidingMenu.setSecondaryMenu(R.layout.slidingmenu_network_drawer);
    slidingMenu.setSecondaryShadowDrawable(R.drawable.shadowright);
    if (savedInstanceState == null) {
        mNavigationDrawerFragment = new FragmentNavigationDrawer();
        mNetworkDrawerFragment    = new FragmentNetworkDrawer();
        this.getSupportFragmentManager().beginTransaction()
                .replace(R.id.navigation_drawer_frame, mNavigationDrawerFragment).commit();
        this.getSupportFragmentManager().beginTransaction()
                .replace(R.id.network_drawer_frame, mNetworkDrawerFragment).commit();
    } else {
        mNavigationDrawerFragment = (FragmentNavigationDrawer) this.getSupportFragmentManager().findFragmentById(R.id.navigation_drawer_frame);
        mNetworkDrawerFragment = (FragmentNetworkDrawer) this.getSupportFragmentManager().findFragmentById(R.id.network_drawer_frame);
    }
    slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);

    /*
     * the tablayout for status and chat message with a viewpager.
     * note that we cannot swipe views with the viewpager as the swipe
     * gesture is catched by slidingmenu to slide the panel
     */
    TabLayout tabLayout = (TabLayout) findViewById(R.id.home_tab_layout);
    viewPager = (ViewPager) findViewById(R.id.home_viewpager);
    pagerAdapter = new HomePagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(pagerAdapter);
    viewPager.addOnPageChangeListener(onPageChangeListener);
    tabLayout.setupWithViewPager(viewPager);

    // little hack to set the icons instead of text
    notifStatus = renderTabView(this, R.drawable.ic_world,  (ViewGroup)tabLayout.getParent());
    notifChat   = renderTabView(this, R.drawable.ic_forum_white_24dp, (ViewGroup)tabLayout.getParent());
    tabLayout.getTabAt(0).setCustomView(notifStatus);
    tabLayout.getTabAt(1).setCustomView(notifChat);
    tabLayout.setSelectedTabIndicatorHeight(10);

    // for notification
    refreshStatusNotifications();
    refreshChatNotifications();
    EventBus.getDefault().register(this);
}
 
开发者ID:Marlinski,项目名称:Rumble,代码行数:56,代码来源:HomeActivity.java


注:本文中的com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.attachToActivity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。