android-screen-support

How to handle difference screen sizes so that a textview scales

痞子三分冷 提交于 2019-12-24 07:29:49
问题 I have to distribute text over a view uniformly. Have been unable to figure out a way that satisfies all screen sizes or even the common screen sizes. The layout I want to achieve is shown below. The red box tells the textview I am trying to work on. I have tried following approaches: 1) Try to use a image, with and without nine patch and it does not scale correctly. 2) try to use different size buckets like sw320 sw480 sw600 and sw720. And while it does fix this for devices I am able to test

Drawables are always read from mdpi folder, regardless of screen size

核能气质少年 提交于 2019-12-22 07:57:25
问题 I am trying to create an application that works both on Samsung galaxy tab GT P1000 and samsung galaxy tab 10.1; The samsung galaxy tab 10.1 (1280 * 800) has a much bigger screen than that of the GT P1000, so I am assuming the GT P1000 should read from hdpi, and 10.1 should read from xhdpi. The surprise is that both of them are reading from the mdpi folder. Regards 回答1: Large screen size does not necessarily means high pixel density. For pixel density you have to consider both physical screen

How to prevent automatic screen lock on android by code?

丶灬走出姿态 提交于 2019-12-18 11:04:40
问题 In my app there is a long loading process, and if the devices puts on the screen lock, my process stops for some reason. How can i prevent the device from automatic screen lock? 回答1: you have to declare this uses-permission on AndroidManifest: <uses-permission android:name="android.permission.WAKE_LOCK" /> And in your code Activity: PowerManager powerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE); WakeLock wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE

How to restrict app to Android phones only

不羁岁月 提交于 2019-12-17 11:44:35
问题 Hello I am targeting users to Android phones only. I want to restrict the app to install on Android phones ony not on phablets and tablets. What are the configuration do I need to apply in AndroidManifest.xml so that Google Play app wont show the app in the table and phablets. Thanks in advance. 回答1: Quoting the documentation: Because the system generally scales applications to fit larger screens well, you shouldn't need to filter your application from larger screens. As long as you follow

Scale factor for xxhdpi android?

我的未来我决定 提交于 2019-12-17 02:52:36
问题 according to http://developer.android.com/training/multiscreen/screendensities.html The following scale factors are mentioned xhdpi: 2.0 hdpi: 1.5 mdpi: 1.0 (baseline) ldpi: 0.75 I was wondering what the scale factor would be for xxhdpi? 回答1: In android.util.DisplayMetrics, you can see that scaling factor is 0.00625 : /** * Scaling factor to convert a density in DPI units to the density scale. * @hide */ public static final float DENSITY_DEFAULT_SCALE = 1.0f / DENSITY_DEFAULT; Where as

Android application only for 10" tablets not latest phones

馋奶兔 提交于 2019-12-13 20:29:32
问题 How can I limit my app to be only for tablets? E.g. how to support Galaxy Tab but not Galaxy SIII ? Both have the same resolution and density. Will this code be sufficient: <supports-screens android:largeScreens="false" android:normalScreens="false" android:requiresSmallestWidthDp="720" android:smallScreens="false" android:xlargeScreens="true" /> After reading docs again, is having below section: <compatible-screens> <screen android:screenSize="xlarge" android:screenDensity="mdpi" /> <screen

How to create an android application that support and run perfect all screen size mobile device and Tablets?

会有一股神秘感。 提交于 2019-12-13 09:33:43
问题 Here I develop one application which has menu screen with 8 icons on that screen, i have two sets of icon according to size. 1 set icon size is 197 * 253 2 set icon size is 184 * 236 when i run this app in Tablet is look very nice, but when i run this app in Phone it looks very odd, it not looks well. 回答1: You need to create different layout folder for Supporting Multiple Screens. ayout-small layout-normal layout-large it better to refer Multiple screen support in android. 来源: https:/

Android tvdpi vs xhdpi screen issue

痴心易碎 提交于 2019-12-13 05:53:49
问题 I'm developing an app for a tablet which until recently was tested in an emulator for Nexus 7 (7.27'',800x1280:tvdpi). Everything was fine until I decided to test the app in a different emulator, one created similar to samsung galaxy note 2 (5.6'',720x1280:xhdpi) and it doesn't look so well. For example, take a look at this custom alert dialog I'm using. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dialog

How to preview which devices a requiresSmallestWidthDp config matches?

和自甴很熟 提交于 2019-12-13 05:37:28
问题 As is well-known, to limit Google Play distribution to devices with certain dimensions, you'd use <supports-screens> or <compatible-screens> , depending on your needs. For example, to allow installation only on 7" tablets or larger, you'd set requiresSmallestWidthDp to 600: <supports-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="true" android:xlargeScreens="true" android:requiresSmallestWidthDp="600" /> My question is, is there any way to check, in

How to use RecyclerView according to device screensize?

喜你入骨 提交于 2019-12-12 10:44:41
问题 I have a backend API endpoint which returns JSON in some sets. Each set contain 10 lines of Json . For example: curl http://www.something.com?getData=0 will give first 10 elements and curl http://www.something.com?getData=1 will return next set and so on. I am using RecyclerView and StaggeredGridView to load data from given endpoints . Right now I am only fetching first set and it's working perfectly fine. What I am looking for? How can I load data in RecyclerView as per screen sizes in