新建了工程,在ConstraintLayout 布局里面拖拽Button进去预览不显示,但是运行的手机上是可以显示,如下图:



点击refresh不起任何作用。
虽然Button显示出来,但是xml里面有爆出红色警告:This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime unless you add the constraints,如下图:

又是一顿Google和Baidu,找到一个链接https://developer.android.com/studio/write/java8-support?utm_source=android-studio,按下图找了很久都没有找到界面:


即可消除警告。
到此两个问题就迎刃而解,感谢阅读。
参考链接:
1.https://www.jianshu.com/p/723811aa4dfe
网友评论