滑动菜单(库)始终全屏 [英] Sliding menu (library) always fullscreen

查看:21
本文介绍了滑动菜单(库)始终全屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的应用中实现滑动菜单库.我现在的问题是我似乎无法控制菜单的宽度.它始终是全屏的.

I'm trying to implement the sliding menu library in my app. My problem now is that I don't seem to be able to control the width of the menu. It is always fullscreen.

谁能告诉我如何解决这个问题?

Can anybody tell me how to resolve this?

这是我一直在玩的代码.

Here is the code I've been playing with.

SlidingMenu menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
menu.setBehindWidth(10);
menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);

推荐答案

对于那些碰巧遇到这个问题的人,正在寻找如何解决它 - 我能够通过在我的 onCreate 方法.

For those that happen to stumble upon this question, in search of how to resolve it - I was able to resolve my issue by using the following code in my onCreate method.

SlidingMenu sm = getSlidingMenu();
sm.setShadowWidthRes(R.dimen.slidingmenuWidth);
sm.setBehindOffsetRes(R.dimen.slidingmenuOffset);
sm.setFadeDegree(0.35f);
sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

<dimen name="slidingmenuWidth">15dp</dimen>
<dimen name="slidingmenuOffset">60dp</dimen>

这篇关于滑动菜单(库)始终全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆