android-screen

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 do I get the ScreenSize programmatically in android

半世苍凉 提交于 2019-11-26 03:08:22
问题 Android defines screen sizes as Normal Large XLarge etc. It automatically picks between static resources in appropriate folders. I need this data about the current device in my java code. The DisplayMetrics only gives information about the current device density. Nothing is available regarding screen size. I did find the ScreenSize enum in grep code here However this does not seem available to me for 4.0 SDK. Is there a way to get this information? 回答1: Copy and paste this code into your