《Pro Android Graphics》读书笔记之第五节

Android DIP: Device-independent Pixel Graphics Design

How Android Supports Device Displays: UI Design and UX 

Device Display Concepts: Size, Density, Orientation, DIP 

size Type

small, normal, large, extra large, extra extra large

screen density

the number of physical pixels contained in a one inch area of a given device’s display screen

density type

low or LDPI, medium or MDPI, tv or TVDPI, high or HDPI, extra high or XHDPI and XXHDPI

Density Independence: Creating Similar User Experiences

Android Multi-Screen Support Via <supports-screens> Tag

				in manifest:	<supports-screens android:largeScreens="true" android:xlargeScreens="true" />

Providing Device-Optimized User Interface Layout Designs

Using Android’s SmallestWidth Screen Configuration Modifier

takes the format sw#dp 

使用这个格式,进行屏幕判断,使用不同xml文件。

720 DIP, then you would use this qualifier to create the layout resource folder named /res/layout-sw720dp to hold your user interface layout definition XML files for your app’s Activities

Using the Available Screen Width Screen Configuration Modifier

w#dp (example: w480dp):横竖屏 切换 使用不同布局(根据可视宽度)

不用同时关注方向和屏幕大小:This is due to the fact that even on the larger tablet devices, you often don’t want to use the same multiple pane UI layout design for the portrait orientation as you do for the landscape orientation. With the width screen configuration modifier, you can use something like w640dp to specify a 640 DIP minimum available screen area width for your layout, instead of having to implement both the screen size qualifier and orientation qualifier.


Using the Available Screen Height Screen Configuration Modifier

h#dp (example: h600dp)

Providing Device-Optimized Image Drawable Assets

资源匹配过程

no density-matching assets can be located in your /res/drawable folders, Android will use your default assets, which are kept in the /res/drawable folder; if none are found there, Android will use the MDPI density resources in the /res/drawable-mdpi folder, and will then scale these up or down as needed to match the current screen size and density.

作者经验

I keep only XML definitions for things like animations and transitions in this /res/drawable folder, and then keep all of my pixel-based digital imaging assets in those various density-specific /res/drawable-dpi folders. 

本文件夹没有,去别的文件夹找,然后按比例缩放。

res/drawable-nodpi

no scale 

/res/drawable-land-hdpi would contain landscape HDPI assets


The DisplayMetrics Class: Size, Density, and Font Scaling

package : android.util

display physical size in both the X and Y dimensions

DisplayMetrics currentDeviceDisplayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(currentDeviceDisplayMetrics);

DisplayMetrics : 参数


Optimizing Android Application Icons for LDPI to XXXHDPI

Installing the New App Icon in the Correct Density Folders

Configuring the AndroidManifest.xml for Custom App Icon






















 







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值