android-screen-support

Setting drawable folder to use for different resolutions

南楼画角 提交于 2019-11-26 03:49:48
问题 I have 4 different sizes for each of the icons I need to use in my app. The problem is My Nexus 7 (1280 x 800) and galaxy s2 (800 x 480) seem to use the resources in drawable-hdpi. How do I force the Nexus to use resources in drawable-xhdpi and then the 10 inch tab to use drawable-xxhdpi. I have this in my manifest file <supports-screens android:resizeable=\"true\" android:smallScreens=\"true\" android:normalScreens=\"true\" android:largeScreens=\"true\" android:xlargeScreens=\"true\" android

How to determine device screen size category (small, normal, large, xlarge) using code?

风格不统一 提交于 2019-11-26 02:33:34
Is there any way to determine the category of screen size of the current device, such as small, normal, large, xlarge? Not the density, but the screen size. Jeff Gilfelt You can use the Configuration.screenLayout bitmask. Example: if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) { // on a large screen device ... } Mel The code below fleshes out the answer above, displaying the screen size as a Toast. //Determine screen size if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE

About Android image and asset sizes

一笑奈何 提交于 2019-11-26 02:15:35
问题 I need to clarify some doubt about the image assets for my app, if I specify in an xml file that the height of something [image view] is 50 dip height which type of screen should i choose from the resources folder? drawable, hdpi, ldpi, mdpi, xhdpi, to have the 50 px height image, and what is the percentage for bigger, smaller size images compared to the base image, like in iOS, @2x, is literally 2 times the size of the image, and you say programatically the normal size, thanks! 回答1: mdpi is

How to determine device screen size category (small, normal, large, xlarge) using code?

一曲冷凌霜 提交于 2019-11-26 01:10:20
问题 Is there any way to determine the category of screen size of the current device, such as small, normal, large, xlarge? Not the density, but the screen size. 回答1: You can use the Configuration.screenLayout bitmask. Example: if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) { // on a large screen device ... } 回答2: The code below fleshes out the answer above, displaying the screen size as a Toast. //Determine

How to define dimens.xml for every different screen size in android?

时光总嘲笑我的痴心妄想 提交于 2019-11-25 22:00:56
问题 When supporting different screen sizes (densities) in Android often the focus is on creating different layouts for every possible screen. I.E. ldpi mdpi hdpi xhdpi xxhdpi xxxhdpi I designed a layout for an xhdpi screen as a reference, and defined it\'s dimensions in dimens.xml . Now I want to give support it to every possible screen size. How can I do that? As far as I know, I can use this tool to figure out the proper dimens.xml for other screen sizes and add it to my project. Is this the