简体   繁体   中英

Samsung Galaxy Tab size on run time

How to get Samsung Galaxy Tab size on run time? If I use

Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int width = display.getWidth(); 

It gives 320*480 size. But its not the tab size. Is there any other way to get the tab size in runtime?.

Thanks, Yuvaraj.K

I got the answer:

DisplayMetrics displayMetrics = new DisplayMetrics();

getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);

int height = displayMetrics.heightPixels;
int width = displayMetrics.widthPixels;

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