當拖放控件到屏幕時,會報2個錯誤:
錯誤信息1:Failed to load AppCompat ActionBar with unknown error.
錯誤信息2:This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime unless you add the constraints。
如圖:
解決辦法:
打開styles.xml文件,修改
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
變成:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
返回activity_main.xml 的Design 界面,可以看到剛剛拖放的button按鈕顯示出來了。
但是它現在仍然有一個錯誤提示。再點擊位於上方工具欄的Infer Constraints,即可解決問題。
交流指教請聯繫:[email protected]。