dpi

移动端适配、移动端事件,理想视口

牧云@^-^@ 提交于 2019-12-08 02:09:10
禁止滚动条 取消滚动条的默认样式:html{height:100%;overflow:hidden;} body{height:100%;overflow:hidden;} 并在js中写入:document.addEventListener('touchstart',function(event){ event.preventDefault();}) 移动端事件 changedTouches 触发当前事件手指的列表(默认是一个)【经常使用】 (当前事件) targetTouches 触发当前目标元素上的手指列表(可以是多个) (当前元素) touches 当前屏幕上的手指列表(可以是多个) (屏幕上的手指数) 使用时使用的是 changedTouches[0]; eg. 获取event事件中的clientX属性__ event.changedTouches[0].clientX 在移动端操作必做的步骤 : 1. <meta name="viewport" content="width=device-width,initial-scale=1.0 /> 2. * {margin:0; padding:0;} (某些Chrome不能取消默认行为时 *{action-touch:none;}) html,body{height:100%; overflow:hidden;} 3.

安卓APP开发中的屏幕适配问题如何解决?

爷,独闯天下 提交于 2019-12-07 23:46:46
1 为什么要进行Android屏幕适配 由于 Android 系统的开放性,任何用户、开发者、 OEM 厂商、运营商都可以对 Android 进行定制,于是导致: Android 系统碎片化 : 小米定制的 MIUI 、魅族定制的 flyme 、华为定制的 EMUI 等等——当然都是基于 Google 原生系统定制的; Android 机型屏幕尺寸碎片化 : 5 寸、 5.5 寸、 6 寸等等; Android 屏幕分辨率碎片化 : 320x480 、 480x800 、 720x1280 、 1080x1920。 屏幕尺寸分布图 据友盟指数显示,统计至 2015 年 12 月,支持 Android 的设备共有 27796 种。 当 Android 系统、屏幕尺寸、屏幕密度出现碎片化的时候,就很容易出现同一元素在不同手机上显示不同的问题。 虽然系统为使您的应用适用于不同的屏幕,会进行缩放和大小调整,但您应针对不同的屏幕尺寸和密度优化应用。 这样可以最大程度优化所有设备上的用户体验,用户会认为您的应用实际上是专为他们的设备而设计,而不是简单地拉伸以适应其设备屏幕。 2 相关概念 2.1 屏幕尺寸 含义:按屏幕对角测量的实际物理尺寸。 为简便起见, Android 将所有实际屏幕尺寸分组为四种通用尺寸:小、 正常、大和超大 单位 : 英寸( inch ),一英寸≈ 2.54cm 2.2

移动端尺寸基础知识

眉间皱痕 提交于 2019-12-07 23:43:17
原文:http://www.cnblogs.com/chris-oil/p/5367106.html 初涉移动端设计和开发的同学们,基本都会在尺寸问题上纠结好一阵子才能摸到头绪。我也花了很长时间才弄明白,感觉有必要写一篇足够通俗易懂的教程来帮助大家。从原理说起,理清关于尺寸的所有细节。由于是写给初学者的,所以不要嫌我啰嗦。 现象 首先说现象,大家都知道移动端设备屏幕尺寸非常多,碎片化严重。尤其是Android,你会听到很多种分辨率:480x800, 480x854, 540x960, 720x1280, 1080x1920,而且还有传说中的2K屏。近年来iPhone的碎片化也加剧了:640x960, 640x1136, 750x1334, 1242x2208。 不要被这些尺寸吓倒。实际上大部分的app和移动端网页,在各种尺寸的屏幕上都能正常显示。说明尺寸的问题一定有解决方法,而且有规律可循。 像素密度 要知道,屏幕是由很多像素点组成的。之前提到那么多种分辨率,都是手机屏幕的实际像素尺寸。比如480x800的屏幕,就是由800行、480列的像素点组成的。每个点发出不同颜色的光,构成我们所看到的画面。而手机屏幕的物理尺寸,和像素尺寸是不成比例的。最典型的例子,iPhone 3gs的屏幕像素是320x480,iPhone 4s的屏幕像素是640x960。刚好两倍,然而两款手机都是3

手机网页H5 自适应不同分辨率的屏幕 必学标签meta之viewport

孤人 提交于 2019-12-07 23:32:18
viewport 语法介绍 <meta name="viewport" content=" height = [pixel_value | device-height] , width = [pixel_value | device-width ] , initial-scale = float_value , minimum-scale = float_value , maximum-scale = float_value , user-scalable = [yes | no] , target-densitydpi = [dpi_value | device-dpi | high-dpi | medium-dpi | low-dpi] "/> width 控制 viewport 的大小,可以指定的一个值或者特殊的值,如 device-width 为设备的宽度(单位为缩放为 100% 时的 CSS 的像素)。 height 和 width 相对应,指定高度。 initial-scale 初始缩放。即页面初始缩放程度。这是一个浮点值,是页面大小的一个乘数。例如,如果你设置初始缩放为“1.0”,那么,web页面在展现的时候就会以target density分辨率的1:1来展现。如果你设置为“2.0”,那么这个页面就会放大为2倍。 maximum-scale 最大缩放

Issue with DP calculation on 7“ tablet & 7” tablet emulator

醉酒当歌 提交于 2019-12-07 22:55:06
问题 I am having some problems with the dp calculation for a 7" tablet (800x480px). Below is my way of calculating. Can't find where I am making a mistake in calculation or my thought: I have three devices that I'm testing: Nexus One: 800x480px, 3.7" display (specs) Huawei Ideos: 320x240px, 2.8" display (specs) Ainol Novo 7" Tablet: 800x480px, 7" display (specs) Based on the display size, I'm calculating the DPI (dots per inch) manually, based on the formular: sqrt(w^2 + h^2) / in So I am getting:

Same DPI but different inch size

丶灬走出姿态 提交于 2019-12-07 09:57:03
问题 I know the Internet is overwhelmed with questions about DPI px inches and so on. But after several hours of googling my situation doesnt seem to happen to anyone else! I have 2 devices custom build with android studio which are both mdpi. BUT one device is 3.65inch and the other device is an 10.1 inch. I have created a folder with 2 images 250x125 with the dpi set to 160 dpi If normally I would declare my 2 images in my XML with dp units instead of pixels...I would suppose on both screens the

Transform Screen.PrimaryScreen.WorkingArea to WPF dimensions at higher DPI settings

心不动则不痛 提交于 2019-12-07 09:47:18
问题 I have the following function in my WPF application that I use to resize a window to the primary screen's working area (the whole screen minus the taskbar): private void Window_Loaded(object sender, RoutedEventArgs e) { int theHeight = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height; int theWidth = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width; this.MaxHeight = theHeight; this.MinHeight = theHeight; this.MaxWidth = theWidth; this.MinWidth = theWidth; this.Height =

C# Getting DPI Scaling for each Monitor in Windows

这一生的挚爱 提交于 2019-12-07 09:46:16
问题 I'm working with code in a WPF application that needs to figure out the DPI scaling size for each monitor in Windows. I'm able to figure out the DPI of the primary screen but for some reason I cannot figure out how to get the scale for other monitors - the others all return the same DPI as the main monitor. There's a bit of code to do this so bear with me. The first set of code deals with getting the DPI based on an HWND. The code gets the active monitor and then retrieves the DPI settings

How can I display a 5mm grid at the proper scale in a web browser?

China☆狼群 提交于 2019-12-07 03:21:05
问题 I'm creating a web application for displaying ECGs, which are conventionally drawn at fixed scales (10 mm/mV and 25 mm/s) on a 5mm square grid. It's important to use the correct size, because readers compare what they see on-screen with other ECGs that may exist only on paper. The most recommended solution is to use CSS to style a div such that it has absolute dimensions of (say) 1" by 1", and to use JavaScript to obtain its height and width (see, for example, How to detect the screen DPI

Handle runtime change of DPI (text size) on Windows 10

我怕爱的太早我们不能终老 提交于 2019-12-06 21:41:25
问题 On Windows 10, the system no longer requires restart (logoff/logon) to change DPI (text size). My application is not ready for such a runtime change. How does system inform an application that the DPI is changing? What message should I handle? I'm using C++ Builder, so I'm looking for a pure WinAPI solution, no WinForms. 回答1: As @TLama and @DalijaPrasnikar commented, the message to handle is WM_DPICHANGED. #define WM_DPICHANGED 0x02E0 The message is available since Windows 8.1, where it is