screen-density

Proper usage of metrics with Kivy(So GUI scales well across devices)

若如初见. 提交于 2021-02-11 08:42:01
问题 I am trying to get my game to look/scale well across different devices. I am attempting to introduce the dp and sp metrics into my apps as much as possible, but in this case I am refactoring a game to use these metrics for layout and widget sizing. Where before, my layouts were sized using size_hint in order to have everything get it's size relative to it's parent(the app itself is not given a size, nor is the window, but the root widget/layout has size_hint=(1, 1) ), I am now faced with

Different sizes of images in Android

不羁岁月 提交于 2019-12-26 17:41:04
问题 I'm trying to create main activity in my application using GridView. I need to have a grid 3x3. Every cell contains ImageView (icons for different actions). All images must have the same size. And my question is: what sizes of image I must use? I watched tutorial and found a table with sizes for different resolutions and density. But I didn't understand. For instance, I have mdpi density and screen size 480*800. Does it mean that I should use icons 160*266 for this screen? And what sizes

Android screen density dpi vs ppi

穿精又带淫゛_ 提交于 2019-12-23 17:49:25
问题 According to the android documentation, density should be in dpi (dots per inch) and all layout measurement should be in dp . and using a simple formula android can map dp to actual pixels. px = dp * (dpi / 160), 160dpi ~ medium density screen which is the baseline So why not just use ppi (pixels per inch) to describe screen density ? 回答1: There is a lot of documentation about this issue, but I think this part is relevant for your question: Supporting Multiple Screens Density independence

Getting weird font size after setting it programmatically

倾然丶 夕夏残阳落幕 提交于 2019-12-23 03:45:07
问题 I am trying to set TextView font size programmatically. txtView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); But when I check this size via Toast.makeText(this, "txt: " + txtView.getTextSize(), Toast.LENGTH_SHORT).show(); The Toast shows that the size is "24" which is 50% larger then the one I set before. I tested multiple values and always get the same result: 8 becomes 12 10 becomes 15 15 becomes 22.5 etc. The font I am trying to set always becomes 50% larger. Why is this happening? Where

Why Nexus 6 density is 560 dpi?

元气小坏坏 提交于 2019-12-17 16:15:20
问题 How to prepare resources for Nexus 6? If I put images to xxxhdpi they will scale down and lose quality. I put images to xxhdpi they will scale up and lose quality. Why developers decided setup value 560dpi for density, if real density 493ppi is more closer to xxhdpi ~480dpi? The Nexus 6 boasts an impressive 5.96” Quad HD screen display at a resolution of 2560 x 1440 (493 ppi). This translates to ~ 730 x 410 dp (density independent pixels). Nexus 6 has a quantized density of 560 dpi, which

App not visible on certain devices

走远了吗. 提交于 2019-12-13 07:14:50
问题 I've published an app on Google Play Store but it is unsupported for a number of devices such Sony Xperia Z2, OnePlus2 etc. The manifest file for my app is: <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" /> <compatible-screens> <!-- small size screens --> <screen android:screenDensity="ldpi" android:screenSize="small" /> <screen android:screenDensity="mdpi" android:screenSize="small" />

Creating an emulator for Galaxy S8? - Android Studio

浪子不回头ぞ 提交于 2019-12-12 07:43:52
问题 I create a new hardware profile in an attempt to make and emulator for the Galaxy S8/S8+. I set the screen size to 5.8/6.2 inches (depending on whether S8 or S8+, despite the fact this doesn't appear to affect emulator anyway), and the screen resolution to 1440 x 2960, like the device. The emulator appears nothing like it does on the real device. Testing my app on a real S8+ shows it to be laid out poorly, but on the emulator it appear to be relatively organised, and I noticed it uses the

How to create an avd with android studio to preview a real device?

不羁岁月 提交于 2019-12-12 04:36:56
问题 I have created an avd of Xiomi Redmi 3s (294dpi), whose specifications are: The generalized densities in Android are: Ldpi (low) ~ 120 dpi -> dp = px * 0.74 Mdpi (average) ~ 160 dpi -> dp = px * 1 Hdpi (high) ~ 240 dpi -> dp = px * 1.5 Xhdpi (extraalta) ~ 320 dpi -> dp = px * 2 Xxhdpi (extra extraalta) ~ 480 dpi -> dp = px * 3 Xxxhdpi (extra extra extraalta) ~ 640 dpi -> dp = px * 4 When I create the avd with device specifications, the assigned density is xhdpi (x2), but the actual device

ImageView size for phones and tablets

十年热恋 提交于 2019-12-11 06:46:54
问题 I'm making something like a dashboard for my app. And everything fine except situation with ImageView size for diffrent device's screen inch. It looks fine on phones and devices 7" and less But on devices more than 7" it's looking bad In all cases I used same size of ImageView - 50dp and I have generate MDPI, HDPI, XHDPI, XXHDPI images If I will use dimens I will get blured images because MDPI, HDPI, XHDPI, XXHDPI images will be generated only for 50dp, but not for 100dp <?xml version="1.0"

Android xxhdpi, 420 dpi and 480 dpi

て烟熏妆下的殇ゞ 提交于 2019-12-10 19:27:28
问题 I'm facing the next problem: I have a values-xxhdpi with their dimensions.xml. Devices with 480 dpi work great with this folder. The problem is that for example Samsung Galaxy S4 or S5 catch the values from this folder and not look well in screen because they have a 420 dpi. So I need to create a values-SOMETHING to this type or devices. I try adding values-w410dp and work fine, but if I add this folder the devices with 480 dpi now catch de values from this folder and not the values from the