最近在做收银机相关的开发,涉及到双屏异显
的一些东西,之前也没有接触过,在查阅一番资料之后,把功能走通了,这里小记一下。
Presentation
Presentation 是一种特殊的对话框,主要用于在另外一块屏幕上显示内容。默认为克隆模式,即副屏显示和正屏一样的内容。当需要显示不同内容时,需要自定义 Presentation,并为其指定一个 Display。这里随便定义一个 Presentation:1
2
3
4
5
6
7
8
9
10
11
12public class MyPresentation extends Presentation {
public MyPresentation(Context outerContext, Display display) {
super(outerContext, display);
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.presentation_second_screen);
}
}