Xamarin : Designer show error : you need to use a theme.appcompat theme (or descendant) with the design library


這個問題是出現在使用 Visual Studio 2017 Xamarin 建立 Android 單一檢視應用程式時發生的問題,主要原因應該


原因是這個專案預設使用了 appcompat 主題的 android.support.design.widget.CoordinatorLayout 框架,而預設主題無法解析這個框架導致錯誤


如果你在 Designer 的畫面上點擊 show error 就可以看到這個相關訊息
java.lang.IllegalArgumentException was throw
 you need to use a theme.appcompat theme (or descendant) with the design library


如果堅持使用 CoordinatorLayout 解決方式就是去更改 Designer 上的 主題(Theme),將它改為 Theme.AppCompat 樣式

就可以正常顯示了











留言

這個網誌中的熱門文章

【研究】列印的條碼為什麼很難刷(掃描)

C# 使用 Process.Start 執行外部程式

統一發票列印小程式