JessYanCoding / JessYanCoding/AndroidAutoSize
适配异常
- 主要語言
- Java
- 星號
- 13.7k
- 分支
- 2k
- PR 合併指標
- 30 天內沒有已合併 PR
描述
### Environment
- [x] Autosize Version: 1.2.1
- [x] Target Android Version: Android 11
- [x] Device Model: MIUI
- [x] Device Resolution:
- [x] Design Size On AndroidManifest: 375dp * 812dp
操作:默认尺寸:375*812 MainActivity 跳转TestActivity前修改designWidthInDp = 812,TestActivity横屏,TestActivity退出时修改 designWidthInDp = 375,同时通知MainActivity刷新UI。回到MainActivity界面适配异常(在MIUI 12.2.3 Android11上面异常,未升级系统前适配正常)
### Log:
```log
异常情况:
---- MIUI12.2.3+ Android11----
2021-03-08 10:16:10.290 25766-25766/com.xxx.xxx D/AndroidAutoSize: The com.xxx.xxx.ui.activity.MainActivity has been adapted!
MainActivity Info: isBaseOnWidth = true, designWidthInDp = 375.000000, designWidthInSubunits = 375.000000, targetDensity = 2.880000, targetScaledDensity = 2.880000, targetDensityDpi = 460, targetXdpi = 2.880000, targetScreenWidthDp = 375, targetScreenHeightDp = 754
2021-03-08 10:16:10.314 25766-25766/com.xxx.xxx D/AndroidAutoSize: com.xxx.xxx.ui.activity.MainActivity used the global configuration.
2021-03-08 10:16:10.314 25766-25766/com.xxx.xxx D/AndroidAutoSize: The com.xxx.xxx.ui.activity.MainActivity has been adapted!
MainActivity Info: isBaseOnWidth = true, designWidthInDp = 375.000000, designWidthInSubunits = 375.000000, targetDensity = 2.880000, targetScaledDensity = 2.880000, targetDensityDpi = 460, targetXdpi = 2.880000, targetScreenWidthDp = 375, targetScreenHeightDp = 754
2021-03-08 10:13:48.873 24184-24184/com.xxx.xxx D/AndroidAutoSize: initScaledDensity = 2.75 on ConfigurationChanged
//跳转Test
2021-03-08 10:13:48.883 24184-24184/com.xxx.xxx D/AndroidAutoSize: com.xxx.xxx.ui.activity.TestActivity used the global configuration.
2021-03-08 10:13:48.883 24184-24184/com.xxx.xxx D/AndroidAutoSize: The com.xxx.xxx.ui.activity.TestActivity has been adapted!
TestActivity Info: isBaseOnWidth = true, designWidthInDp = 812.000000, designWidthInSubunits = 812.000000, targetDensity = 2.955665, targetScaledDensity = 2.955665, targetDensityDpi = 472, targetXdpi = 2.955665, targetScreenWidthDp = 812, targetScreenHeightDp = 332
2021-03-08 10:13:49.662 24184-24184/com.xxx.xxx D/AndroidAutoSize: com.xxx.xxx.ui.activity.TestActivity used the global configuration.
2021-03-08 10:13:49.663 24184-24184/com.xxx.xxx D/AndroidAutoSize: The com.xxx.xxx.ui.activity.TestActivity has been adapted!
TestActivity Info: isBaseOnWidth = true, designWidthInDp = 812.000000, designWidthInSubunits = 812.000000, targetDensity = 2.955665, targetScaledDensity = 2.955665, targetDensityDpi = 472, targetXdpi = 2.955665, targetScreenWidthDp = 812, targetScreenHeightDp = 332
2021-03-08 10:14:16.583 24184-24184/com.xxx.xxx D/AndroidAutoSize: The com.xxx.xxx.ui.activity.TestActivity has been adapted!
//返回Main
MainActivity Info: isBaseOnWidth = true, designWidthInDp = 375.000000, designWidthInSubunits = 375.000000, targetDensity = 6.400000, targetScaledDensity = 6.400000, targetDensityDpi = 1024, targetXdpi = 6.400000, targetScreenWidthDp = 375, targetScreenHeightDp = 153
2021-03-08 10:14:17.273 24184-24184/com.xxx.xxx D/AndroidAutoSize: initScaledDensity = 2.75 on ConfigurationChanged
-----------------------------------------
正常情况:
---- EMUI Android10 ----
2021-03-08 10:27:58.164 15455-15455/com.xxx.xxx D/AndroidAutoSize: The com.xxx.xxx.ui.activity.MainActivity has been adapted!
MainActivity Info: isBaseOnWidth = true, designWidthInDp = 375.000000, designWidthInSubunits = 375.000000, targetDensity = 2.880000, targetScaledDensity = 2.880000, targetDensityDpi = 460, targetXdpi = 2.880000, targetScreenWidthDp = 375, targetScreenHeightDp = 675
2021-03-08 10:27:58.229 15455-15455/com.xxx.xxx D/AndroidAutoSize: com.xxx.xxx.ui.activity.MainActivity used the global configuration.
2021-03-08 10:27:58.230 15455-15455/com.xxx.xxx D/AndroidAutoSize: The com.xxx.xxx.ui.activity.MainActivity has been adapted!
MainActivity Info: isBaseOnWidth = true, designWidthInDp = 375.000000, designWidthInSubunits = 375.000000, targetDensity = 2.880000, targetScaledDensity = 2.880000, targetDensityDpi = 460, targetXdpi = 2.880000, targetScreenWidthDp = 375, targetScreenHeightDp = 675
//跳转Test
2021-03-08 10:28:35.518 15455-15455/com.xxx.xxx D/AndroidAutoSize: com.xxx.xxx.ui.activity.TestActivity used the global configuration.
2021-03-08 10:28:35.519 15455-15455/com.xxx.xxx D/AndroidAutoSize: The com.xxx.xxx.ui.activity.TestActivity has been adapted!
TestActivity Info: isBaseOnWidth = true, designWidthInDp = 812.000000, designWidthInSubunits = 812.000000, targetDensity = 2.502463, targetScaledDensity = 2.502463, targetDensityDpi = 400, targetXdpi = 2.502463, targetScreenWidthDp = 812, targetScreenHeightDp = 397
2021-03-08 10:28:36.850 15455-15455/com.xxx.xxx D/AndroidAutoSize: com.xxx.xxx.ui.activity.TestActivity used the global configuration.
2021-03-08 10:28:36.850 15455-15455/com.xxx.xxx D/AndroidAutoSize: The com.xxx.xxx.ui.activity.TestActivity has been adapted!
TestActivity Info: isBaseOnWidth = true, designWidthInDp = 812.000000, designWidthInSubunits = 812.000000, targetDensity = 2.502463, targetScaledDensity = 2.502463, targetDensityDpi = 400, targetXdpi = 2.502463, targetScreenWidthDp = 812, targetScreenHeightDp = 397
//返回Main
2021-03-08 10:30:43.190 16693-16693/com.xxx.xxx D/AndroidAutoSize: com.xxx.xxx.ui.activity.MainActivity used the global configuration.
2021-03-08 10:30:43.191 16693-16693/com.xxx.xxx D/AndroidAutoSize: The com.xxx.xxx.ui.activity.MainActivity has been adapted!
MainActivity Info: isBaseOnWidth = true, designWidthInDp = 375.000000, designWidthInSubunits = 375.000000, targetDensity = 2.880000, targetScaledDensity = 2.880000, targetDensityDpi = 460, targetXdpi = 2.880000, targetScreenWidthDp = 375, targetScreenHeightDp = 675
### Others:
父类activity已重写getResource
目前看来是某些原因导致计算参数错误
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
Start by reproducing the transition from MainActivity to the landscape TestActivity and back on MIUI 12.2.3 with Android 11, using the logged AndroidAutoSize values as checkpoints. Inspect the overridden getResource implementation in the parent activity and compare the MIUI logs with the working EMUI Android 10 logs. Done means MainActivity returns with correct adaptation parameters and UI sizing.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- android, java
- 領域
- mobile-dev
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100