wildma / Screenadaptation
🔥一种非常好用的 Android 屏幕适配——smallestWidth 限定符适配 https://www.jianshu.com/p/1302ad5a4b04
Stars: ✭ 1,123
Programming Languages
java
68154 projects - #9 most used programming language
Labels
Projects that are alternatives of or similar to Screenadaptation
LayerX
An intuitive app to display transparent images on screen.
Stars: ✭ 136 (-87.89%)
Mutual labels: screen
Screenmanager
Flexible way to manage screens with transitions for Unity
Stars: ✭ 300 (-73.29%)
Mutual labels: screen
SimpleScreens
Simple Screens is a library of screens and screen components (forms, sections, transitions) to be included, extended, or generally reused in applications based on Moqui Framework and Mantle Business Artifacts.
Stars: ✭ 20 (-98.22%)
Mutual labels: screen
Calces Gradle Plugin
Android构建工具集:包含快速实现组件化构建脚本,快速实现屏幕最小宽度适配脚本
Stars: ✭ 366 (-67.41%)
Mutual labels: screen
IRLSize
A library for determining the actual physical size of pixels on an iOS device.
Stars: ✭ 14 (-98.75%)
Mutual labels: screen
Fakelogonscreen
Fake Windows logon screen to steal passwords
Stars: ✭ 710 (-36.78%)
Mutual labels: screen
Linux Command
Linux命令大全搜索工具,内容包含Linux命令手册、详解、学习、搜集。https://git.io/linux
Stars: ✭ 17,481 (+1456.63%)
Mutual labels: screen
Gbt
Highly configurable prompt builder for Bash, ZSH and PowerShell written in Go.
Stars: ✭ 457 (-59.31%)
Mutual labels: screen
MMM-MagicMover
MagicMirror² module to avoid screen burn-in
Stars: ✭ 21 (-98.13%)
Mutual labels: screen
ScreenHelper
android 屏幕适配的终极方案: SmallestWidth适配修改和 DisplayMetrics.densityDpi属性, 完美兼容 AndroidX 和 Android 库 ^_^ ,欢迎使用~~
Stars: ✭ 36 (-96.79%)
Mutual labels: screen
YellowDot
Hide the macOS yellow recording dot in the corner of your screen
Stars: ✭ 21 (-98.13%)
Mutual labels: screen
Screentask
(📢 New Version Released) Screen sharing made easy! Share your screen across local devices without internet.
Stars: ✭ 466 (-58.5%)
Mutual labels: screen
macos-blank-screensaver
Blank (black) screensaver for MacOS
Stars: ✭ 27 (-97.6%)
Mutual labels: screen
React On Screen
Check if a react component in the viewport
Stars: ✭ 357 (-68.21%)
Mutual labels: screen
Bangjago Android Emulator
simple android emulator cli for mobile development
Stars: ✭ 56 (-95.01%)
Mutual labels: screen
一种非常好用的 Android 屏幕适配——smallestWidth 限定符适配
使用
- 获取设计图最小宽度(单位为 dp)。
- 以设计图最小宽度作为基准值,生成所有设备对应的 dimens.xml 文件。
如果项目只需要适配手机的话,只需要生成 320、360、362.2641、384、392.7272、400、410、411.4285、432、480 对应的 dimens.xml 文件即可。 - 根据设计图标注,标注多少 dp,布局中就写多少 dp,格式为 @dimen/dp_XX。
详细介绍请看文章:一种非常好用的 Android 屏幕适配
优点
-
使用简单
利用插件生成对应的 dimens.xml 文件,设计图标注多少 dp,布局中就写多少 dp,格式为 @dimen/dp_XX,sp 同理。 -
稳定性好
smallestWidth 限定符适配方案很早就出现了,经过大量用户的验证,市面上的主流设备几乎都能精准适配。 -
对性能无影响
适配原理是系统根据限定符去寻找对应的 dimens.xml 文件,并不影响程序的性能。 -
兼容性好
smallestWidth 限定符适配寻找 dimens.xml 文件的原理是从大往小找,没有对应的则使用默认的,所以即使没有完全匹配也能达到不错的适配效果。 -
不影响第三方库
需要适配的地方使用该种适配方案即可,不会影响到第三方库。 -
更换成本低
该套适配方案采用的单位是 dp 和 sp,dp 和 sp 是 google 推荐使用的计量单位,即使以后不用该套适配方案,任然不影响现有的界面。
适配效果图
如下,将按钮的宽度设置为 @dimen/dp_360,运行在不同(最小宽度不同)的设备上都是可以铺满屏幕宽度的,说明适配成功!
Nexus S(320 dp):
Nexus 5(360 dp):
Nexus 4(384 dp):
Pixel 3(392.7272 dp):
Pixel XL(411.4285 dp):
Pixel 3 XL(411.4285 dp):
ps:如果对你有帮助,点下 star 就是对我最大的认可。
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].