android-screen

Android : App support for multiple tablet screen resolutions

社会主义新天地 提交于 2019-11-26 19:31:17
问题 I just ran my Android application on Galaxy Tab Emulator, where the design looks distracted. Now my worry is how to make the app fit perfectly on all the Tablet Screens. Since I came acrosss diffrent screen resolutions for Android Tablets. For example: Samsung Galaxy Tab 10.1 3G - 10.1 inches, 1280 x 800 pixels Samsung P1000 Galaxy Tab - 7.0 inches, 600 x 1024 pixels Dell Streak 7 - 7-inch 800×480 Motorola Xoom - 10.1-inch, 1280×800 Viewsonic G - 10.1-inchs 1024×600 For small, medium, large .

Android DisplayMetrics returns incorrect screen size in pixels on ICS

走远了吗. 提交于 2019-11-26 18:42:21
I've tried this.... DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int fullscreenheight = metrics.heightPixels; int fullscreenwidth = metrics.widthPixels; and.... Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int height = size.y; The Gnex has a display of 720×1280. The returned result for width/height (depending on orientation of course) is never 1280. I thought this might have something to do with the on screen navigation bar in Ice Cream Sandwich, so I

Supporting multiple screen size - Android

杀马特。学长 韩版系。学妹 提交于 2019-11-26 17:53:38
I am going to develop new application in Android. This application should only work in portrait (even for tablet). Also the UI and layout design should be similar on phones and tablet. We can't change the layout design for tablet as it has huge area to use. We have to stretch all the images to match phones. We can use nine patch. But I am little bit confused of using images in multiple drawables. As per my analysis (may be wrong.. : ) ) the screens are divided into density and sizes. We can use the scaling ratio of 3:4:6:8. But this ratio is based on the density. But in my case I have to

How to get android device screen size?

一个人想着一个人 提交于 2019-11-26 17:25:09
I have two android device with same resolution Device1 -> resolution 480x800 diagonal screen size -> 4.7 inches Device2 -> resolution 480x800 diagonal screen size -> 4.0 inches How to find device diagonal screen size? Detect 7 inch and 10 inch tablet programmatically I have used the above link but it gives both device diagonal screen size -> 5.8 Ali Ahmad try this code to get screen size in inch DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int width=dm.widthPixels; int height=dm.heightPixels; double wi=(double)width/(double)dm.xdpi; double hi

Different design for landscape and portrait orientation android

£可爱£侵袭症+ 提交于 2019-11-26 16:59:42
问题 Can we have a different xml for landscape and different xml for portrait orientation? I am working on a simple app, have few buttons and textviews, the xml looks good in portrait, But with same xml when I check the landscape orientation, design doesn't look good. Any suggestions are appreciated.. Thank you. 回答1: Yes ofcourse. You will have to create two versions of xml files and put in layout-port and layout-land folder inside res folder. eg : res/layout [Portrait Mode; default] main.xml res

Android: Disable application for tablet

和自甴很熟 提交于 2019-11-26 15:38:37
问题 I developed an application, Now i want to restrict the application for tablet. Means the application should not run on any tablets. For that I specify the support-screens in Androidmenifest.XML file as: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.abc.xyz" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="17" android:maxSdkVersion="17" /> <supports-screens android:smallScreens="true" android

Setting drawable folder to use for different resolutions

强颜欢笑 提交于 2019-11-26 14:13:33
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:anyDensity="true" /> How do I force the Nexus to use resources in drawable-xhdpi and then the 10 inch tab to use

How do I get the ScreenSize programmatically in android

北战南征 提交于 2019-11-26 12:54:45
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? Copy and paste this code into your Activity and when it is executed it will Toast the device's screen size category. int screenSize = getResources(

Android DisplayMetrics returns incorrect screen size in pixels on ICS

浪子不回头ぞ 提交于 2019-11-26 06:31:18
问题 I\'ve tried this.... DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int fullscreenheight = metrics.heightPixels; int fullscreenwidth = metrics.widthPixels; and.... Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int height = size.y; The Gnex has a display of 720×1280. The returned result for width/height (depending on orientation of course) is never 1280.

How to get android device screen size?

橙三吉。 提交于 2019-11-26 05:25:21
问题 I have two android device with same resolution Device1 -> resolution 480x800 diagonal screen size -> 4.7 inches Device2 -> resolution 480x800 diagonal screen size -> 4.0 inches How to find device diagonal screen size? Detect 7 inch and 10 inch tablet programmatically I have used the above link but it gives both device diagonal screen size -> 5.8 回答1: try this code to get screen size in inch DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int