开发者

How to find out the device screen resolution and density to set same UI display on the emulator and device?

开发者 https://www.devze.com 2023-01-23 19:53 出处:网络
I need to set开发者_如何学C same UI in both device and emulator (In my application the UI changing in emulator and device)for that i need to know the screen resolution and density of the device . I do

I need to set开发者_如何学C same UI in both device and emulator (In my application the UI changing in emulator and device)for that i need to know the screen resolution and density of the device . I don't know how to find out that .Let me know how to find out that in device.

Thanks,

Lakshmanan


    DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    int screenHeight = displaymetrics.heightPixels;
    int screenWidth = displaymetrics.widthPixels;
0

精彩评论

暂无评论...
验证码 换一张
取 消