screen-density

Layout displayed differently on different devices at the same resolution screen

Deadly 提交于 2019-12-10 03:36:18
问题 Problem: layout displayed differently on different devices at the same resolution screen. I tested it on Samsung Galaxy S4 (1080x1920) and on LG G2 (1080x1920). It the same resolution, so why layout is displayed differently on each device ? I have all in layout folder and not have another layouts for other resolutions. Here are screens: Samsung Galaxy S4 http://www.image-share.com/ijpg-2963-272.html LG G2 http://www.image-share.com/ijpg-2963-271.html EDIT #1 <RelativeLayout xmlns:android=

Drawing on Canvas issue in high end devices

二次信任 提交于 2019-12-07 05:23:53
问题 I want to draw a SeekBar on canvas programmatically. I wrote code to set the LayoutParams of the SeekBar based on device density. I am using switch case with device density like final DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); if(metrics.densityDpi <= DisplayMetrics.DENSITY_LOW){ zoomBarParams = new LinearLayout.LayoutParams(18, LayoutParams.FILL_PARENT); } else if (metrics.densityDpi <= DisplayMetrics.DENSITY_MEDIUM){ zoomBarParams = new LinearLayout.LayoutParams(24,

Drawing on Canvas issue in high end devices

不羁岁月 提交于 2019-12-05 10:36:06
I want to draw a SeekBar on canvas programmatically. I wrote code to set the LayoutParams of the SeekBar based on device density. I am using switch case with device density like final DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); if(metrics.densityDpi <= DisplayMetrics.DENSITY_LOW){ zoomBarParams = new LinearLayout.LayoutParams(18, LayoutParams.FILL_PARENT); } else if (metrics.densityDpi <= DisplayMetrics.DENSITY_MEDIUM){ zoomBarParams = new LinearLayout.LayoutParams(24, LayoutParams.FILL_PARENT); }else if (metrics.densityDpi <= DisplayMetrics.DENSITY_HIGH){ zoomBarParams

Layout displayed differently on different devices at the same resolution screen

*爱你&永不变心* 提交于 2019-12-05 04:06:07
Problem: layout displayed differently on different devices at the same resolution screen. I tested it on Samsung Galaxy S4 (1080x1920) and on LG G2 (1080x1920). It the same resolution, so why layout is displayed differently on each device ? I have all in layout folder and not have another layouts for other resolutions. Here are screens: Samsung Galaxy S4 http://www.image-share.com/ijpg-2963-272.html LG G2 http://www.image-share.com/ijpg-2963-271.html EDIT #1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout

Why does my Galaxy Note 3 have the same DP dimensions as a much smaller phone?

纵然是瞬间 提交于 2019-12-04 17:38:59
I have been reading about dp, px, ppi and dpi for awhile now, and I am lost. Why is it that a large phone like the Galaxy Note 3 (with a 5.7 inch display) can have the same dp as a Moto X (with only 4.7 inches )? My calculation for each returns a width=360dp and height=640dp . It seems like many higher density phones fall in this range. Is this true or am I misunderstanding dp ? I am using the following to calculate my values: How to determine the screen width in terms of dp or dip at runtime in Android? Onik Because it's not just a matter of screen size, it is also a matter of screen density.

Creating an emulator for Galaxy S8? - Android Studio

自闭症网瘾萝莉.ら 提交于 2019-12-03 09:38:17
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 dimens for my Nexus 6 emulator (xxxhdpi). Now the dimens values used isn't a big deal, because I'm happy

Not able to understand how to use different density images for 1.6+?

不打扰是莪最后的温柔 提交于 2019-11-30 07:55:33
I'm trying to understand how the res/drawables images should work with different screen densities. Right now I've got a 1.5 app, and for example, I have an image that is 100x100 pixels. When used on the Droid, it scales this image so it appears to be the same size relatively on that device (all other layout scaling is handled by me, using dip units). So now I need to update my project and add three folders, right?: drawable-ldpi drawable-mdpi drawable-hdpi so I'm going to put my 100x100 image in the -mdpi folder. If I want to make a version for the -hdpi folder - how do I know how much larger

Not able to understand how to use different density images for 1.6+?

雨燕双飞 提交于 2019-11-29 10:23:41
问题 I'm trying to understand how the res/drawables images should work with different screen densities. Right now I've got a 1.5 app, and for example, I have an image that is 100x100 pixels. When used on the Droid, it scales this image so it appears to be the same size relatively on that device (all other layout scaling is handled by me, using dip units). So now I need to update my project and add three folders, right?: drawable-ldpi drawable-mdpi drawable-hdpi so I'm going to put my 100x100 image

Android studio selecting wrong layouts

大憨熊 提交于 2019-11-27 08:39:48
问题 I am new to Android. I am building my first application. I have been trying to make it support multiple screens. I have gone through the developers section in android, but, I am not clear at these things. What is the resolution, I should use for the different drawable folders? (for example an hdpi screen may have 500*600 screen or 1280*1920 screen.) I have been using layout folders as mentioned in the developers page, like small, normal and the rest, but android keeps on selecting normal

getting the screen density programmatically in android?

点点圈 提交于 2019-11-25 22:00:14
问题 How to get the screen density programmatically in android? I mean: How to find the screen dpi of the current device? 回答1: You can get info on the display from the DisplayMetrics struct: DisplayMetrics metrics = getResources().getDisplayMetrics(); Though Android doesn't use a direct pixel mapping, it uses a handful of quantized Density Independent Pixel values then scales to the actual screen size. So the metrics.densityDpi property will be one of the DENSITY_xxx constants ( 120 , 160 , 213 ,