本文整理汇总了Java中com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.setBehindOffset方法的典型用法代码示例。如果您正苦于以下问题:Java SlidingMenu.setBehindOffset方法的具体用法?Java SlidingMenu.setBehindOffset怎么用?Java SlidingMenu.setBehindOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jeremyfeinstein.slidingmenu.lib.SlidingMenu
的用法示例。
在下文中一共展示了SlidingMenu.setBehindOffset方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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();
}
});
}
示例3: 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();
}
示例4: 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);
}
示例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);
}
示例6: 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);// 设置全屏触摸
int width = getWindowManager().getDefaultDisplay().getWidth();// 获取屏幕宽度
slidingMenu.setBehindOffset(width * 200 / 320); // 设置预留屏幕的宽度
initFragment();
}
示例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();
}
}
示例8: onCreate
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EventBus.getDefault().register(this);
if (new SpTool(this, SpTool.SP_SETTING).getBoolean("moon", false)) {
BaseApplication.sDefaultImageDrawable = R.drawable.z_iv_default_y;
setTheme(R.style.ActivityThemeMoon);
} else {
BaseApplication.sDefaultImageDrawable = R.drawable.z_iv_default;
setTheme(R.style.ActivityTheme);
}
// set the Above View
if (savedInstanceState != null) {
mFragmentMainHome = (FragmentMainHome) getSupportFragmentManager().getFragment(savedInstanceState, "mFragmentMainHome");
}
if (mFragmentMainHome == null) {
mFragmentMainHome = new FragmentMainHome();
mFragmentMainHome.setArguments(getIntent().getExtras());
}
setContentView(R.layout.activity_main_sliding);
getSupportFragmentManager().beginTransaction()
.replace(R.id.content_frame, mFragmentMainHome)
.commit();
// set the Behind View
setBehindContentView(R.layout.v_layout_sliding_menu);
if (savedInstanceState != null) {
mFragmentSlidingMenu = (FragmentSlidingMenu) this.getSupportFragmentManager().findFragmentById(R.id.menu_frame);
}
if (mFragmentSlidingMenu == null) {
mFragmentSlidingMenu = new FragmentSlidingMenu();
getSupportFragmentManager().beginTransaction()
.replace(R.id.menu_frame, mFragmentSlidingMenu)
.commit();
}
// customize the SlidingMenu
SlidingMenu sm = getSlidingMenu();
sm.setShadowWidthRes(R.dimen.slidingmenu_shadow_width);
sm.setShadowDrawable(R.drawable.v_sliding_menu_shadow);
sm.setBehindOffset(ScreenTools.getScreenParams(this).width * 3 / 10);
sm.setFadeDegree(0.35f);
//设置触摸方式,必须为 TOUCHMODE_FULLSCREEN(全屏可触摸),TOUCHMODE_MARGIN(边缘可触摸),默认 48dp, TOUCHMODE_NONE(不可触摸)三者之一
sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
//动画效果
sm.setBehindScrollScale(0.0f);
sm.setBackgroundColor(Color.parseColor("#252525"));
sm.setBehindCanvasTransformer(getTransformer(1));
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}