This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime

文章目录

      • 解决方法:
        • 1、自动添加约束
        • 2、手动添加约束

做的第一个 Android 应用程序是直接照着课本敲得,但是结果却不一样
正常界面:
This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime_第1张图片
运行界面:
This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime_第2张图片
后来发现这里是有错的
This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime_第3张图片
这句话的意思大概是:这个view没有被约束,它仅仅有设计时的位置,因此它将跳到(0,0),除非你添加约束。

解决方法:

1、自动添加约束

点击控件后直接点击这个魔法棒,就会自动添加约束,它只是Android Studio自带的自动添加约束的一个工具。但是自动添加的约束有时候不能满足想要的场景,所以一般都是手动添加约束,有兴趣的可以自己试试这个魔法棒。
This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime_第4张图片

2、手动添加约束

直接贴链接啦:http://blog.csdn.net/guolin_blog/article/details/53122387

你可能感兴趣的:(Android,异常解决)