《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
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
相關文章
- JVM讀書筆記之OOMJVM筆記OOM
- 「Linux」鳥叔私房菜第五章讀書筆記Linux筆記
- 《Maven實戰》之讀書筆記Maven筆記
- JVM讀書筆記之記憶體管理JVM筆記記憶體
- MySQL 8.0 Reference Manual(讀書筆記68節--Deadlocks)MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記90節--Replication)MySql筆記
- 讀書筆記筆記
- 《數學之美》讀書筆記&思考筆記
- 《讀書與做人》讀書筆記筆記
- MySQL 8.0 Reference Manual(讀書筆記63節--InnoDB Locking)MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記64節--InnoDBTransaction Model)MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記65節--InnoDBLocks Set)MySql筆記BloC
- MySQL 8.0 Reference Manual(讀書筆記45節--Optimization Overview)MySql筆記View
- MySQL 8.0 Reference Manual(讀書筆記94節--Replication(5))MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記93節--Semisynchronous Replication)MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記67節--Phantom Rows)MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記92節--Replication(3))MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記91節--Replication(2))MySql筆記
- webpackDemo讀書筆記Web筆記
- Vue讀書筆記Vue筆記
- 散文讀書筆記筆記
- Cucumber讀書筆記筆記
- HTTP 讀書筆記HTTP筆記
- postgres 讀書筆記筆記
- 讀書筆記2筆記
- 讀書筆記3筆記
- JVM讀書筆記之java記憶體結構JVM筆記Java記憶體
- MySQL 8.0 Reference Manual(讀書筆記80節-- InnoDB Row Formats)MySql筆記ORM
- MySQL 8.0 Reference Manual(讀書筆記69節--InnoDB Startup Configuration)MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記56節--Optimizing Database Structure)MySql筆記DatabaseStruct
- MySQL 8.0 Reference Manual(讀書筆記54節--Optimization and Indexes(1))MySql筆記Index
- MySQL 8.0 Reference Manual(讀書筆記55節--Optimization and Indexes(2))MySql筆記Index
- MySQL 8.0 Reference Manual(讀書筆記53節--Optimizing SQL Statements)MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記41節-- Data Types(3))MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記40節-- Data Types(2))MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記39節-- Data Types(1))MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記57節--Optimizing for InnoDB Tables)MySql筆記
- JVM讀書筆記之垃圾收集與記憶體分配JVM筆記記憶體
- 張紹文android開發高手課讀書筆記1Android筆記