新建了工程,在ConstraintLayout 布局里面拖拽Button进去预览不显示,但是运行的手机上是可以显示,如下图:
![](https://img.haomeiwen.com/i6374879/075064982280d01c.png)
![](https://img.haomeiwen.com/i6374879/e58e02087e366206.png)
![](https://img.haomeiwen.com/i6374879/b6753f2a0e25b7bf.png)
点击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,如下图:
![](https://img.haomeiwen.com/i6374879/4b6ee5b95245b638.png)
又是一顿Google和Baidu,找到一个链接https://developer.android.com/studio/write/java8-support?utm_source=android-studio,按下图找了很久都没有找到界面:
![](https://img.haomeiwen.com/i6374879/e287d18095c94925.png)
![](https://img.haomeiwen.com/i6374879/cb38b68b51c2fb14.png)
即可消除警告。
到此两个问题就迎刃而解,感谢阅读。
参考链接:
1.https://www.jianshu.com/p/723811aa4dfe
网友评论