I am playing around with the circular positioning provided by ConstraintLayout
. In the below sample app I have a TextView
centered on the screen and an ImageView
circularly constrained to the TextView
with a radius of 50dps and an angle of 45 degrees. It should be fully constrained as there are no more XML attributes starting with app:layout_constraintCircle
, so I assume I have fully declared its intended position. However, Android Studio gives me the following warning on the ImageView
:
This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime unless you add the constraints
Running the application proves me right as the constrained view is in its correct location and does not jump to the start of the layout.
So my question is: am I missing any additional constraints or is Android Studio somehow bugged not recognizing circular constraining as valid?
Example XML layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/hello_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/ic_launcher_background"
app:layout_constraintCircle="@id/hello_text"
app:layout_constraintCircleAngle="45"
app:layout_constraintCircleRadius="50dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>