本文整理汇总了Java中com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.setSecondaryMenu方法的典型用法代码示例。如果您正苦于以下问题:Java SlidingMenu.setSecondaryMenu方法的具体用法?Java SlidingMenu.setSecondaryMenu怎么用?Java SlidingMenu.setSecondaryMenu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jeremyfeinstein.slidingmenu.lib.SlidingMenu
的用法示例。
在下文中一共展示了SlidingMenu.setSecondaryMenu方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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);
}