安卓抽屉菜单(侧滑菜单)全屏设置

有时候抽屉菜单想要设置全屏显示,只需要在Activity初始化的时候增加如下代码即可,设置方法如下:

其中llRightMenu为侧滑菜单。

 1   
 2 WindowManager wm = this.getWindowManager();//获取屏幕宽高
 3        
 4  int width1 = wm.getDefaultDisplay().getWidth();
 5        
 6  int height1 = wm.getDefaultDisplay().getHeight();
 7        
 8  ViewGroup.LayoutParams para= llRightMenu.getLayoutParams();
 9 //获取drawerlayout的布局
10         
11 para.width=width1;//修改宽度
12         
13 para.height=height1;//修改高度
14         
15 llRightMenu.setLayoutParams(para); //设置修改后的布局。

猜你喜欢

转载自www.cnblogs.com/Lucifer1mm/p/10344084.html
今日推荐