【AndroidStudio】This view is not constrained〜っていうエラー
先ほどAndroid開発始めました、うにそんです。
画面作ろうと思ってxmlファイル開いて、frameLayoutを追加したところで標題のエラーが出ました。
「This view is not constrained, it only has designtime positions, so it will jump to (0,0) unless you add constraints」
うーんなんか制約がないって言ってますね。
あれか、iOSのオートレイアウトみたいにLayoutをどこ基準に配置するか指定してあげればいいのかなーと思って、おもむろにプレビュー画面で右クリックして
Center Horizontally,Cener Verticallyを選んだところ、下記の行が追加されてエラーが消えました
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
うん、やっぱりレイアウトをどこ基準でおいたらいいのか分からないよってことだったみたいですね。