开源鸿蒙 Display Development

  • 2022-08-09
  • 浏览 (677)

Display Development

When to Use

An application can obtain the default display object or all display objects by calling the Display APIs.

Available APIs

For details about the APIs, see Display.

How to Develop

Call getDefaultDisplay(): Promise to obtain the default display object. An example code snippet is as follows:

import display from '@ohos.display' // Import the module.

let disp; // disp is used to save the default display object.
display.getDefaultDisplay().then((disp) => {
	console.log('display.getDefaultDisplay success, display :' + JSON.stringify(disp));
}, (err) => {
    console.log('display.getDefaultDisplay failed, error : ' + JSON.stringify(err));
})

你可能感兴趣的文章

开源鸿蒙 Window Manager

开源鸿蒙 Display Overview

开源鸿蒙 Screenshot Development

开源鸿蒙 Screenshot Overview

开源鸿蒙 Window Development

开源鸿蒙 Window Manager Overview

0  赞