Images within a constraint layout appear as if i did not set the constraints yet i did

Viewed 53

Everything is fine within the preview. the View gets used as the binding.root for a Recyclerview.Viewholder. Im just getting back into programming after a break so maybe It's something obvious that I'm missing but for the life of me i can't figure it out

edit: now I even changed it to a linear layout but it still does not work! the constraint layout:

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="400dp">
<ImageView
    android:id="@+id/btnPlus"
    android:layout_width="80dp"
    android:layout_height="80dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    android:src="@drawable/btn_plus"
    android:layout_marginEnd="20dp"
    android:layout_marginTop="20dp"/>

<ImageView
    android:id="@+id/btnStat"
    android:layout_width="80dp"
    android:layout_height="80dp"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    android:src="@drawable/btn_stat"
    android:layout_marginStart="20dp"
    android:layout_marginTop="20dp"/>

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

my main xml file. the constraint layout in question is a child of the BotRec

<?xml version="1.0" encoding="utf-8"?>
<layout 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">

<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    tools:context=".Main">
    <ImageView
        android:background="#85baf3"
        android:id="@+id/header"
        android:layout_width="match_parent"
        android:layout_height="35dp"
        android:layout_marginStart="20dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="20dp"
        android:src="@drawable/app_header"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/topRec"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_marginTop="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/header" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/botRec"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/topRec" />


</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

enter image description here

0 Answers
Related