简体   繁体   中英

Android display getSize() before API level 13

What would be the equivalent of the getSize() method pre-API level 13? Specifically, I need something that would work with Gingerbread.

Context context = getActivity();
Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
Point size = new Point();
display.getSize(size);

Try:

width=display.getWidth();
height=display.getHeight();

when target is >= Gingerbread

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM