本文整理汇总了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();
}
示例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);
}
});
}
示例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();
}
示例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();
}
示例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();
}
});
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
}
});
}