开发者

Determining App's Window/Screen Size

开发者 https://www.devze.com 2023-01-31 07:14 出处:网络
How do you determine the size of a component rather than calculating the sizes of all components including the screen and the parent component\'s sizes of the component?

How do you determine the size of a component rather than calculating the sizes of all components including the screen and the parent component's sizes of the component?

I have developed a few apps using android 1.6 but all of them are based on the screen size of the target phones. Since Android is not like Symbian OS, I believe I can create an app that can be installed to any phone running Android OS as long as OS versions are honored.

Say, I am d开发者_如何学Ceveloping for HTC Desire HD. How do I know what should be the window screen size in pixels knowing that Desire has a screen dimension of 4.3 inches?

Thanks.


you can retrieve the device screen dimension with this

            getResources().getDisplayMetrics();
        getResources().getDisplayMetrics().widthPixels;
        getResources().getDisplayMetrics().heightPixels;
0

精彩评论

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