ConstraintLayout not working over some values





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I am using following layout



<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<ImageView
android:layout_margin="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mainImage"
android:scaleType="centerInside"
android:src="@drawable/placeholder"
/>


<LinearLayout
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:layout_constraintLeft_toRightOf="@+id/mainImage"
app:layout_constraintEnd_toEndOf="parent"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<EditText
android:background="@null"
android:layout_width="match_parent"
android:layout_height="35dp"
android:inputType="text"
android:hint="Patient Name"
android:drawablePadding="10dp"
android:textSize="14sp"
android:id="@+id/name"
/>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#80000000"
/>

<EditText
android:background="@null"
android:layout_width="match_parent"
android:layout_height="35dp"
android:inputType="text"
android:hint="Patient Name"
android:drawablePadding="10dp"
android:textSize="14sp"
android:id="@+id/dob"
android:visibility="visible"
/>


</LinearLayout>

<ListView
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/mainImage"
android:layout_marginTop="45dp"
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>


</android.support.constraint.ConstraintLayout>


The result is



enter image description here



The patient name etc should be right of image and list view should be at bottom of image view, why its not recognising constraints










share|improve this question























  • To place the list below the image in ConstraintLayout you need to use app:layout_constraintTop_toBottomOf="@id/mainImage" For the LinearLayout, try set the width to wrap_content instead

    – Zee
    Jan 4 at 7:46











  • if a view's layout_width is match_parent, it disregards the contraints. you should change it to match_constraint with is 0dp.

    – AIMIN PAN
    Jan 4 at 8:02


















0















I am using following layout



<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<ImageView
android:layout_margin="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mainImage"
android:scaleType="centerInside"
android:src="@drawable/placeholder"
/>


<LinearLayout
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:layout_constraintLeft_toRightOf="@+id/mainImage"
app:layout_constraintEnd_toEndOf="parent"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<EditText
android:background="@null"
android:layout_width="match_parent"
android:layout_height="35dp"
android:inputType="text"
android:hint="Patient Name"
android:drawablePadding="10dp"
android:textSize="14sp"
android:id="@+id/name"
/>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#80000000"
/>

<EditText
android:background="@null"
android:layout_width="match_parent"
android:layout_height="35dp"
android:inputType="text"
android:hint="Patient Name"
android:drawablePadding="10dp"
android:textSize="14sp"
android:id="@+id/dob"
android:visibility="visible"
/>


</LinearLayout>

<ListView
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/mainImage"
android:layout_marginTop="45dp"
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>


</android.support.constraint.ConstraintLayout>


The result is



enter image description here



The patient name etc should be right of image and list view should be at bottom of image view, why its not recognising constraints










share|improve this question























  • To place the list below the image in ConstraintLayout you need to use app:layout_constraintTop_toBottomOf="@id/mainImage" For the LinearLayout, try set the width to wrap_content instead

    – Zee
    Jan 4 at 7:46











  • if a view's layout_width is match_parent, it disregards the contraints. you should change it to match_constraint with is 0dp.

    – AIMIN PAN
    Jan 4 at 8:02














0












0








0








I am using following layout



<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<ImageView
android:layout_margin="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mainImage"
android:scaleType="centerInside"
android:src="@drawable/placeholder"
/>


<LinearLayout
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:layout_constraintLeft_toRightOf="@+id/mainImage"
app:layout_constraintEnd_toEndOf="parent"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<EditText
android:background="@null"
android:layout_width="match_parent"
android:layout_height="35dp"
android:inputType="text"
android:hint="Patient Name"
android:drawablePadding="10dp"
android:textSize="14sp"
android:id="@+id/name"
/>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#80000000"
/>

<EditText
android:background="@null"
android:layout_width="match_parent"
android:layout_height="35dp"
android:inputType="text"
android:hint="Patient Name"
android:drawablePadding="10dp"
android:textSize="14sp"
android:id="@+id/dob"
android:visibility="visible"
/>


</LinearLayout>

<ListView
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/mainImage"
android:layout_marginTop="45dp"
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>


</android.support.constraint.ConstraintLayout>


The result is



enter image description here



The patient name etc should be right of image and list view should be at bottom of image view, why its not recognising constraints










share|improve this question














I am using following layout



<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<ImageView
android:layout_margin="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/mainImage"
android:scaleType="centerInside"
android:src="@drawable/placeholder"
/>


<LinearLayout
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:layout_constraintLeft_toRightOf="@+id/mainImage"
app:layout_constraintEnd_toEndOf="parent"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<EditText
android:background="@null"
android:layout_width="match_parent"
android:layout_height="35dp"
android:inputType="text"
android:hint="Patient Name"
android:drawablePadding="10dp"
android:textSize="14sp"
android:id="@+id/name"
/>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#80000000"
/>

<EditText
android:background="@null"
android:layout_width="match_parent"
android:layout_height="35dp"
android:inputType="text"
android:hint="Patient Name"
android:drawablePadding="10dp"
android:textSize="14sp"
android:id="@+id/dob"
android:visibility="visible"
/>


</LinearLayout>

<ListView
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/mainImage"
android:layout_marginTop="45dp"
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>


</android.support.constraint.ConstraintLayout>


The result is



enter image description here



The patient name etc should be right of image and list view should be at bottom of image view, why its not recognising constraints







java android android-studio android-constraintlayout






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 4 at 7:41









Muhammad UmarMuhammad Umar

5,6061566147




5,6061566147













  • To place the list below the image in ConstraintLayout you need to use app:layout_constraintTop_toBottomOf="@id/mainImage" For the LinearLayout, try set the width to wrap_content instead

    – Zee
    Jan 4 at 7:46











  • if a view's layout_width is match_parent, it disregards the contraints. you should change it to match_constraint with is 0dp.

    – AIMIN PAN
    Jan 4 at 8:02



















  • To place the list below the image in ConstraintLayout you need to use app:layout_constraintTop_toBottomOf="@id/mainImage" For the LinearLayout, try set the width to wrap_content instead

    – Zee
    Jan 4 at 7:46











  • if a view's layout_width is match_parent, it disregards the contraints. you should change it to match_constraint with is 0dp.

    – AIMIN PAN
    Jan 4 at 8:02

















To place the list below the image in ConstraintLayout you need to use app:layout_constraintTop_toBottomOf="@id/mainImage" For the LinearLayout, try set the width to wrap_content instead

– Zee
Jan 4 at 7:46





To place the list below the image in ConstraintLayout you need to use app:layout_constraintTop_toBottomOf="@id/mainImage" For the LinearLayout, try set the width to wrap_content instead

– Zee
Jan 4 at 7:46













if a view's layout_width is match_parent, it disregards the contraints. you should change it to match_constraint with is 0dp.

– AIMIN PAN
Jan 4 at 8:02





if a view's layout_width is match_parent, it disregards the contraints. you should change it to match_constraint with is 0dp.

– AIMIN PAN
Jan 4 at 8:02












2 Answers
2






active

oldest

votes


















0














<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"
tools:context=".MainActivity">



<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent">

<ImageView
android:id="@+id/mainImage"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_margin="10dp"
android:scaleType="centerInside"
android:src="@drawable/ic_launcher_foreground"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="@null"
android:drawablePadding="10dp"
android:hint="Patient Name"
android:inputType="text"
android:textSize="14sp" />

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#80000000" />

<EditText
android:id="@+id/dob"
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="@null"
android:drawablePadding="10dp"
android:hint="Patient Name"
android:inputType="text"
android:textSize="14sp"
android:visibility="visible" />
</LinearLayout>


</LinearLayout>


<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="406dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout" />


</android.support.constraint.ConstraintLayout>


I justed tested this code on my project and this worked. Just change a few variables according to your project. Thank you!
This is what you will get from this code:



enter image description here






share|improve this answer

































    1














    You need to constraint view from all sides and use match_constraint (0dp) when you need to take all allowed space



    <android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
    android:id="@+id/mainImage"
    android:layout_width="80dp"
    android:layout_height="80dp"
    android:layout_margin="10dp"
    android:scaleType="centerInside"
    android:src="@drawable/placeholder"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    />


    <LinearLayout
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginRight="10dp"
    android:layout_marginStart="8dp"
    android:orientation="vertical"
    app:layout_constraintBottom_toBottomOf="@+id/mainImage"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintLeft_toRightOf="@+id/mainImage"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintStart_toEndOf="@+id/mainImage"
    app:layout_constraintTop_toTopOf="@+id/mainImage">

    <EditText
    android:id="@+id/name"
    android:layout_width="match_parent"
    android:layout_height="35dp"
    android:background="@null"
    android:drawablePadding="10dp"
    android:hint="Patient Name"
    android:inputType="text"
    android:textSize="14sp"
    />

    <View
    android:layout_width="match_parent"
    android:layout_height="1dp"
    android:background="#80000000"
    />

    <EditText
    android:id="@+id/dob"
    android:layout_width="match_parent"
    android:layout_height="35dp"
    android:background="@null"
    android:drawablePadding="10dp"
    android:hint="Patient Name"
    android:inputType="text"
    android:textSize="14sp"
    android:visibility="visible"
    />


    </LinearLayout>

    <ListView
    android:id="@+id/listView"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/mainImage"/>


    </android.support.constraint.ConstraintLayout>





    share|improve this answer
























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54034850%2fconstraintlayout-not-working-over-some-values%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      <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"
      tools:context=".MainActivity">



      <LinearLayout
      android:id="@+id/linearLayout"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginRight="10dp"
      android:orientation="horizontal"
      app:layout_constraintEnd_toEndOf="parent">

      <ImageView
      android:id="@+id/mainImage"
      android:layout_width="80dp"
      android:layout_height="80dp"
      android:layout_margin="10dp"
      android:scaleType="centerInside"
      android:src="@drawable/ic_launcher_foreground"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent" />

      <LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical">

      <EditText
      android:id="@+id/name"
      android:layout_width="match_parent"
      android:layout_height="35dp"
      android:background="@null"
      android:drawablePadding="10dp"
      android:hint="Patient Name"
      android:inputType="text"
      android:textSize="14sp" />

      <View
      android:layout_width="match_parent"
      android:layout_height="1dp"
      android:background="#80000000" />

      <EditText
      android:id="@+id/dob"
      android:layout_width="match_parent"
      android:layout_height="35dp"
      android:background="@null"
      android:drawablePadding="10dp"
      android:hint="Patient Name"
      android:inputType="text"
      android:textSize="14sp"
      android:visibility="visible" />
      </LinearLayout>


      </LinearLayout>


      <ListView
      android:id="@+id/listView"
      android:layout_width="match_parent"
      android:layout_height="406dp"
      android:layout_marginTop="8dp"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintTop_toBottomOf="@+id/linearLayout" />


      </android.support.constraint.ConstraintLayout>


      I justed tested this code on my project and this worked. Just change a few variables according to your project. Thank you!
      This is what you will get from this code:



      enter image description here






      share|improve this answer






























        0














        <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"
        tools:context=".MainActivity">



        <LinearLayout
        android:id="@+id/linearLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp"
        android:orientation="horizontal"
        app:layout_constraintEnd_toEndOf="parent">

        <ImageView
        android:id="@+id/mainImage"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_margin="10dp"
        android:scaleType="centerInside"
        android:src="@drawable/ic_launcher_foreground"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

        <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <EditText
        android:id="@+id/name"
        android:layout_width="match_parent"
        android:layout_height="35dp"
        android:background="@null"
        android:drawablePadding="10dp"
        android:hint="Patient Name"
        android:inputType="text"
        android:textSize="14sp" />

        <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#80000000" />

        <EditText
        android:id="@+id/dob"
        android:layout_width="match_parent"
        android:layout_height="35dp"
        android:background="@null"
        android:drawablePadding="10dp"
        android:hint="Patient Name"
        android:inputType="text"
        android:textSize="14sp"
        android:visibility="visible" />
        </LinearLayout>


        </LinearLayout>


        <ListView
        android:id="@+id/listView"
        android:layout_width="match_parent"
        android:layout_height="406dp"
        android:layout_marginTop="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/linearLayout" />


        </android.support.constraint.ConstraintLayout>


        I justed tested this code on my project and this worked. Just change a few variables according to your project. Thank you!
        This is what you will get from this code:



        enter image description here






        share|improve this answer




























          0












          0








          0







          <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"
          tools:context=".MainActivity">



          <LinearLayout
          android:id="@+id/linearLayout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginRight="10dp"
          android:orientation="horizontal"
          app:layout_constraintEnd_toEndOf="parent">

          <ImageView
          android:id="@+id/mainImage"
          android:layout_width="80dp"
          android:layout_height="80dp"
          android:layout_margin="10dp"
          android:scaleType="centerInside"
          android:src="@drawable/ic_launcher_foreground"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent" />

          <LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:orientation="vertical">

          <EditText
          android:id="@+id/name"
          android:layout_width="match_parent"
          android:layout_height="35dp"
          android:background="@null"
          android:drawablePadding="10dp"
          android:hint="Patient Name"
          android:inputType="text"
          android:textSize="14sp" />

          <View
          android:layout_width="match_parent"
          android:layout_height="1dp"
          android:background="#80000000" />

          <EditText
          android:id="@+id/dob"
          android:layout_width="match_parent"
          android:layout_height="35dp"
          android:background="@null"
          android:drawablePadding="10dp"
          android:hint="Patient Name"
          android:inputType="text"
          android:textSize="14sp"
          android:visibility="visible" />
          </LinearLayout>


          </LinearLayout>


          <ListView
          android:id="@+id/listView"
          android:layout_width="match_parent"
          android:layout_height="406dp"
          android:layout_marginTop="8dp"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/linearLayout" />


          </android.support.constraint.ConstraintLayout>


          I justed tested this code on my project and this worked. Just change a few variables according to your project. Thank you!
          This is what you will get from this code:



          enter image description here






          share|improve this answer















          <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"
          tools:context=".MainActivity">



          <LinearLayout
          android:id="@+id/linearLayout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginRight="10dp"
          android:orientation="horizontal"
          app:layout_constraintEnd_toEndOf="parent">

          <ImageView
          android:id="@+id/mainImage"
          android:layout_width="80dp"
          android:layout_height="80dp"
          android:layout_margin="10dp"
          android:scaleType="centerInside"
          android:src="@drawable/ic_launcher_foreground"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent" />

          <LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:orientation="vertical">

          <EditText
          android:id="@+id/name"
          android:layout_width="match_parent"
          android:layout_height="35dp"
          android:background="@null"
          android:drawablePadding="10dp"
          android:hint="Patient Name"
          android:inputType="text"
          android:textSize="14sp" />

          <View
          android:layout_width="match_parent"
          android:layout_height="1dp"
          android:background="#80000000" />

          <EditText
          android:id="@+id/dob"
          android:layout_width="match_parent"
          android:layout_height="35dp"
          android:background="@null"
          android:drawablePadding="10dp"
          android:hint="Patient Name"
          android:inputType="text"
          android:textSize="14sp"
          android:visibility="visible" />
          </LinearLayout>


          </LinearLayout>


          <ListView
          android:id="@+id/listView"
          android:layout_width="match_parent"
          android:layout_height="406dp"
          android:layout_marginTop="8dp"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/linearLayout" />


          </android.support.constraint.ConstraintLayout>


          I justed tested this code on my project and this worked. Just change a few variables according to your project. Thank you!
          This is what you will get from this code:



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 4 at 8:01

























          answered Jan 4 at 7:50









          Prateek AggarwalPrateek Aggarwal

          378213




          378213

























              1














              You need to constraint view from all sides and use match_constraint (0dp) when you need to take all allowed space



              <android.support.constraint.ConstraintLayout
              xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:app="http://schemas.android.com/apk/res-auto"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

              <ImageView
              android:id="@+id/mainImage"
              android:layout_width="80dp"
              android:layout_height="80dp"
              android:layout_margin="10dp"
              android:scaleType="centerInside"
              android:src="@drawable/placeholder"
              app:layout_constraintStart_toStartOf="parent"
              app:layout_constraintTop_toTopOf="parent"
              />


              <LinearLayout
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_marginRight="10dp"
              android:layout_marginStart="8dp"
              android:orientation="vertical"
              app:layout_constraintBottom_toBottomOf="@+id/mainImage"
              app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintLeft_toRightOf="@+id/mainImage"
              app:layout_constraintRight_toRightOf="parent"
              app:layout_constraintStart_toEndOf="@+id/mainImage"
              app:layout_constraintTop_toTopOf="@+id/mainImage">

              <EditText
              android:id="@+id/name"
              android:layout_width="match_parent"
              android:layout_height="35dp"
              android:background="@null"
              android:drawablePadding="10dp"
              android:hint="Patient Name"
              android:inputType="text"
              android:textSize="14sp"
              />

              <View
              android:layout_width="match_parent"
              android:layout_height="1dp"
              android:background="#80000000"
              />

              <EditText
              android:id="@+id/dob"
              android:layout_width="match_parent"
              android:layout_height="35dp"
              android:background="@null"
              android:drawablePadding="10dp"
              android:hint="Patient Name"
              android:inputType="text"
              android:textSize="14sp"
              android:visibility="visible"
              />


              </LinearLayout>

              <ListView
              android:id="@+id/listView"
              android:layout_width="match_parent"
              android:layout_height="0dp"
              app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintStart_toStartOf="parent"
              app:layout_constraintTop_toBottomOf="@+id/mainImage"/>


              </android.support.constraint.ConstraintLayout>





              share|improve this answer




























                1














                You need to constraint view from all sides and use match_constraint (0dp) when you need to take all allowed space



                <android.support.constraint.ConstraintLayout
                xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <ImageView
                android:id="@+id/mainImage"
                android:layout_width="80dp"
                android:layout_height="80dp"
                android:layout_margin="10dp"
                android:scaleType="centerInside"
                android:src="@drawable/placeholder"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                />


                <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:layout_marginStart="8dp"
                android:orientation="vertical"
                app:layout_constraintBottom_toBottomOf="@+id/mainImage"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintLeft_toRightOf="@+id/mainImage"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintStart_toEndOf="@+id/mainImage"
                app:layout_constraintTop_toTopOf="@+id/mainImage">

                <EditText
                android:id="@+id/name"
                android:layout_width="match_parent"
                android:layout_height="35dp"
                android:background="@null"
                android:drawablePadding="10dp"
                android:hint="Patient Name"
                android:inputType="text"
                android:textSize="14sp"
                />

                <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="#80000000"
                />

                <EditText
                android:id="@+id/dob"
                android:layout_width="match_parent"
                android:layout_height="35dp"
                android:background="@null"
                android:drawablePadding="10dp"
                android:hint="Patient Name"
                android:inputType="text"
                android:textSize="14sp"
                android:visibility="visible"
                />


                </LinearLayout>

                <ListView
                android:id="@+id/listView"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/mainImage"/>


                </android.support.constraint.ConstraintLayout>





                share|improve this answer


























                  1












                  1








                  1







                  You need to constraint view from all sides and use match_constraint (0dp) when you need to take all allowed space



                  <android.support.constraint.ConstraintLayout
                  xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:app="http://schemas.android.com/apk/res-auto"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent">

                  <ImageView
                  android:id="@+id/mainImage"
                  android:layout_width="80dp"
                  android:layout_height="80dp"
                  android:layout_margin="10dp"
                  android:scaleType="centerInside"
                  android:src="@drawable/placeholder"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toTopOf="parent"
                  />


                  <LinearLayout
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_marginRight="10dp"
                  android:layout_marginStart="8dp"
                  android:orientation="vertical"
                  app:layout_constraintBottom_toBottomOf="@+id/mainImage"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintLeft_toRightOf="@+id/mainImage"
                  app:layout_constraintRight_toRightOf="parent"
                  app:layout_constraintStart_toEndOf="@+id/mainImage"
                  app:layout_constraintTop_toTopOf="@+id/mainImage">

                  <EditText
                  android:id="@+id/name"
                  android:layout_width="match_parent"
                  android:layout_height="35dp"
                  android:background="@null"
                  android:drawablePadding="10dp"
                  android:hint="Patient Name"
                  android:inputType="text"
                  android:textSize="14sp"
                  />

                  <View
                  android:layout_width="match_parent"
                  android:layout_height="1dp"
                  android:background="#80000000"
                  />

                  <EditText
                  android:id="@+id/dob"
                  android:layout_width="match_parent"
                  android:layout_height="35dp"
                  android:background="@null"
                  android:drawablePadding="10dp"
                  android:hint="Patient Name"
                  android:inputType="text"
                  android:textSize="14sp"
                  android:visibility="visible"
                  />


                  </LinearLayout>

                  <ListView
                  android:id="@+id/listView"
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toBottomOf="@+id/mainImage"/>


                  </android.support.constraint.ConstraintLayout>





                  share|improve this answer













                  You need to constraint view from all sides and use match_constraint (0dp) when you need to take all allowed space



                  <android.support.constraint.ConstraintLayout
                  xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:app="http://schemas.android.com/apk/res-auto"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent">

                  <ImageView
                  android:id="@+id/mainImage"
                  android:layout_width="80dp"
                  android:layout_height="80dp"
                  android:layout_margin="10dp"
                  android:scaleType="centerInside"
                  android:src="@drawable/placeholder"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toTopOf="parent"
                  />


                  <LinearLayout
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_marginRight="10dp"
                  android:layout_marginStart="8dp"
                  android:orientation="vertical"
                  app:layout_constraintBottom_toBottomOf="@+id/mainImage"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintLeft_toRightOf="@+id/mainImage"
                  app:layout_constraintRight_toRightOf="parent"
                  app:layout_constraintStart_toEndOf="@+id/mainImage"
                  app:layout_constraintTop_toTopOf="@+id/mainImage">

                  <EditText
                  android:id="@+id/name"
                  android:layout_width="match_parent"
                  android:layout_height="35dp"
                  android:background="@null"
                  android:drawablePadding="10dp"
                  android:hint="Patient Name"
                  android:inputType="text"
                  android:textSize="14sp"
                  />

                  <View
                  android:layout_width="match_parent"
                  android:layout_height="1dp"
                  android:background="#80000000"
                  />

                  <EditText
                  android:id="@+id/dob"
                  android:layout_width="match_parent"
                  android:layout_height="35dp"
                  android:background="@null"
                  android:drawablePadding="10dp"
                  android:hint="Patient Name"
                  android:inputType="text"
                  android:textSize="14sp"
                  android:visibility="visible"
                  />


                  </LinearLayout>

                  <ListView
                  android:id="@+id/listView"
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toBottomOf="@+id/mainImage"/>


                  </android.support.constraint.ConstraintLayout>






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 4 at 7:52









                  Stanislav BondarStanislav Bondar

                  3,53322034




                  3,53322034






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54034850%2fconstraintlayout-not-working-over-some-values%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Monofisismo

                      Angular Downloading a file using contenturl with Basic Authentication

                      Olmecas