public class MainActivity extends Activity {
private DemoPresentation mPresentation;
private Display[] displays;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DisplayManager mDisplayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
displays = mDisplayManager.getDisplays();
mPresentation = new DemoPresentation(MainActivity.this, displays[1], getAssets());//displays[1]是副屏
mPresentation.show();
}
}
public class DemoPresentation extends Presentation {
private AssetManager assets = null;
public DemoPresentation(Context outerContext, Display display, AssetManager manager) {
super(outerContext, display);
assets = manager;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Resources r = getContext().getResources();
setContentView(R.layout.main);
}
private String[] getImages() {
String[] tempImages = null;
try {
if (null != assets) {
tempImages = assets.list("");
}
} catch (Exception e) {
} finally {
return tempImages;
}
}
}
双屏异显 Android
最新推荐文章于 2024-06-25 17:22:31 发布