mobile developement and screen sizes
I'm developing an app for the iphone / a开发者_开发知识库ndriod that should fit inside the browser screen perfectly so that I can safely disable scaling and scrolling but there is no way I know to get the actual screen size. What I mean is the dimensions of the screen after the little top bar and the bottom bar of controls. When I'm on my itouch I get screen.height == 420
instead of 380
. How do I detect it for both ios and andriod?
Android will scale your application to fit the screen size, I have no iOS experience but I know android will change your application to fit the size. Although making different drawables for the different sizes will help make it all look better, but isn't always needed, but recommended.
So with that, why do you need to know the screen size Android devices aren't 'cookie cutters' there is a lot of variation in the market, different resolutions and sizes. So you can't really make the app for a specific size only, you could, but then it would only display properly on that one device and similiar ones. The app is made and scaled to fit, but you as the developer can do things to make it look its' best on each type of screen.
Android has 4 densities, either 'ldpi' 'mdpi' 'hdpi' or 'xhdpi'
everything I have mentioned can be read more in depth here.
http://developer.android.com/guide/practices/screens_support.html
精彩评论