It is not LinearLayout, or RelativeLayout, it ConstraintLayout, so you need to give Left, Right, Bottom, Top Constraintits layout, in your case, you have to give the TextViewfirst Bottom_Toprestriction on TextViewthe second. so you can get margin between two TextView.
Your layout should look like this.
<android.support.constraint.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"
android:background="#ade4ad">
<TextView
android:id="@+id/first"
android:layout_width="90dp"
android:layout_height="40dp"
android:background="#000"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<TextView
android:id="@+id/second"
android:layout_width="90dp"
android:layout_height="40dp"
android:background="#fff"
android:layout_marginTop="10dp"
app:layout_constraintTop_toBottomOf="@+id/first"
app:layout_constraintLeft_toLeftOf="@+id/first"
app:layout_constraintRight_toRightOf="@+id/first" />
</android.support.constraint.ConstraintLayout>
source
share