如何双屏异显?
如题,谢谢! 1.DisplayManagermDisplayManager;//屏幕管理类Display[]displays;//屏幕数组
mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE);
displays =mDisplayManager.getDisplays();
2.主屏和副屏的区分?
主屏:displays
副屏:displays
3.如何在副屏上展示内容?
通过Presentation来实现,Presentation继承了Dialog。假设我们写了一个DifferentDislay的类,这个类是要继承
Presentation类的。代码:
privateclass DifferentDislay extends Presentation{
public DifferentDislay(ContextouterContext, Display display) {
super(outerContext,display);
//TODOAuto-generated constructor stub
}
@Override
protectedvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout02);
}
}
4.开启副屏
DifferentDislaymPresentation =new DifferentDislay (getApplicationContext(),displays);//displays是副屏
mPresentation.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mPresentation.show(); android 几?
页:
[1]