首页 > IT职业 > IT图书 > Android宽度和启动模式
利用java代码设置宽度:
//设置宽度
WindowManager m = getWindow().getWindowManager();
Display d =m.getDefaultDisplay();
WindowManager.LayoutParams p =getWindow().getAttributes();
Point size = new Point();
d.getSize(size);
p.width = (int)(size.x*0.8);//设置dialog的宽度为当前手机屏幕的宽度*0.8
getWindow().setAttributes(p);
Activity的四种启动模式:
android:launchMode属性:standard:标准模式,默认singleTop:Task栈顶复用模式singleTask:Task栈内复用模式singleInstance:全局单例模式
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2799/viewspace-2826127/ ,如需转载,请注明出处,否则将追究法律责任。