發表文章

android app 在api 35後 layout padding失效問題

圖片
Apps targeting Android 15 will be forced into edge-to-edge mode 以 Android 15 (API 級別 35) 為目標版本的應用程式,且在 Android 15 裝置上是從邊到邊顯示。不過,由於 Android 15 強制執行無邊框功能,許多元素現在都會被狀態列、3 鍵導覽列或螢幕凹口隱藏。隱藏的 UI 包括 Material 2 頂端應用程式列、浮動動作按鈕和清單項目。 Android 15(預計是 Android U)對 UI 元件(特別是沉浸式狀態列、NavigationBar、WindowInsets 等)有一些調整,導致許多 App 出現 AppBar 錯位、重疊或 padding 不正確的問題,這種現象在使用 WindowInsetsController 或 Edge-to-Edge 佈局的 App 上尤其常見。 ✅ 問題可能的成因: -WindowInsets 行為改變(例如 fitSystemWindows 已不建議使用)。 -狀態列/導航列高度回傳不同或為 0。 -AppBarLayout 或 Toolbar 沒有正確處理 insets(paddingTop、marginTop)。 -App Theme 沒設好 Edge-to-Edge 支援(例如透明 statusBar 但未補上 inset padding)。 如果你遇到 android:padding="10dp" 在 Android 14/15 無效,就是因為 WindowInsets 影響 layout 運作。 Everything around status bars, toolbars, fullscreen, cutouts, insets, .... has been such a painful experience. 在 Android 14 或 15 實機(或模擬器)上卻完全 沒有效果 (也就是 padding 被吃掉了), 可能出現在 root layout 或 AppBar、Fragment Container 等處 。 大家可以看到上面app bar 跟內容重疊了. https://developer.android.com/about/versions/15/behavio...

在 Mac 電腦上備份樹莓派 (Raspberry Pi) Micro SD 卡

圖片
在 Mac 電腦上備份樹莓派 (Raspberry Pi) Micro SD 卡... 是場災難....手續繁雜還不說,參數還一堆. 一點都不人性化. --- 備份原因:SD卡插在樹莓派都沒啥用到, 512GB 太浪費, 換成小一點的128GB. 步驟1:  找 SD 卡的路徑 $ diskutil list 可看到在/dev/disk19  很重要!備份前先卸載SD卡: sudo diskutil unmount /dev/disk19      ---- 然後是很複雜的參數: What is the 'bs' option in dd? answer: ‘bs=BYTES’, read and write up to BYTES bytes at a time. Set both input and output block sizes to BYTES. This makes ‘dd’ read and write BYTES per block, overriding any ‘ibs’ and ‘obs’ settings. In addition, if no data-transforming ‘conv’ option is specified, input is copied to the output as soon as it’s read, even if it is smaller than the block size. 如果沒加bs選項 ,dd指令會跑很久. 1MB到32MB :大部分 bs=1m 到` bs=32m 是合理的選擇。 --- 看進度要安裝 pv brew install pv 使用 使用 pv 的方法就是把它夾在 input 與 output 中間執行,例如: $ sudo dd if=/dev/disk19  | pv | sudo dd of=./BACKUP.dmg 添加參數 -s [ 記憶卡容量 ] ,就會以進度條的方式呈現,並預估還要多久,例如: $ sudo dd if=/dev/disk19 | pv -s 512G | sudo dd of=./BACKUP.dmg 使用dd這個備份工具的話,...