版权声明:有问题请联系邮箱 [email protected] https://blog.csdn.net/qq_38066103/article/details/83997163
当拖放控件到屏幕时,会报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]。