سؤال

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 developing 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;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top