Can't put LinearLayout to the bottom of page android studio












-1















I want to make a chat layout. I want to put Edittext and Button on the bottom of the screen. I already tried using gravity : bottom and alignParentBottom : true, but it doesn't give any effect about that.



This is my code



<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=".chat">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/friendChat"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Nama"
android:textSize="20dp"
android:paddingTop="10dp"
android:paddingLeft="40dp"
android:textColor="@android:color/white"
android:background="@color/starbuck"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/friendChat"
android:paddingTop="20dp"
android:orientation="horizontal"
android:id="@+id/friendChatContainer"
android:paddingLeft="10dp">

<ImageView
android:id="@+id/avatar"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/avatar" />

<TextView
android:id="@+id/friendChatContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:textSize="16dp"
android:textColor="@android:color/white"
android:text="haloooo"
android:background="@color/starbuck"

/>
</LinearLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/friendChatContainer"
android:paddingTop="20dp"
android:orientation="horizontal"
android:gravity="right"
android:paddingRight="10dp"
android:id="@+id/myChat"
>
<TextView

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:textSize="16dp"
android:textColor="@android:color/white"
android:text="haloooo"
android:background="@color/starbuck"

/>
</RelativeLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/myChat"
android:gravity="bottom">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Write a message"
android:inputType="text"
android:paddingHorizontal="10dp"
android:text="" />

<ImageButton
android:id="@+id/sendChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:scaleType="fitCenter"
android:padding="20dp"
android:layout_marginHorizontal="10dp"
android:background="@drawable/send"/>


</LinearLayout>
</RelativeLayout>

</android.support.constraint.ConstraintLayout>


This is what it looks like with that code :
Layout



The EditText and ImageButton supposed on the bottom of the screen.










share|improve this question

























  • It should be easy: would android:layout_alignParentBottom="true" work if added to the LinearLayout with id of myChat?

    – Aaron
    Nov 20 '18 at 2:28


















-1















I want to make a chat layout. I want to put Edittext and Button on the bottom of the screen. I already tried using gravity : bottom and alignParentBottom : true, but it doesn't give any effect about that.



This is my code



<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=".chat">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/friendChat"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Nama"
android:textSize="20dp"
android:paddingTop="10dp"
android:paddingLeft="40dp"
android:textColor="@android:color/white"
android:background="@color/starbuck"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/friendChat"
android:paddingTop="20dp"
android:orientation="horizontal"
android:id="@+id/friendChatContainer"
android:paddingLeft="10dp">

<ImageView
android:id="@+id/avatar"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/avatar" />

<TextView
android:id="@+id/friendChatContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:textSize="16dp"
android:textColor="@android:color/white"
android:text="haloooo"
android:background="@color/starbuck"

/>
</LinearLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/friendChatContainer"
android:paddingTop="20dp"
android:orientation="horizontal"
android:gravity="right"
android:paddingRight="10dp"
android:id="@+id/myChat"
>
<TextView

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:textSize="16dp"
android:textColor="@android:color/white"
android:text="haloooo"
android:background="@color/starbuck"

/>
</RelativeLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/myChat"
android:gravity="bottom">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Write a message"
android:inputType="text"
android:paddingHorizontal="10dp"
android:text="" />

<ImageButton
android:id="@+id/sendChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:scaleType="fitCenter"
android:padding="20dp"
android:layout_marginHorizontal="10dp"
android:background="@drawable/send"/>


</LinearLayout>
</RelativeLayout>

</android.support.constraint.ConstraintLayout>


This is what it looks like with that code :
Layout



The EditText and ImageButton supposed on the bottom of the screen.










share|improve this question

























  • It should be easy: would android:layout_alignParentBottom="true" work if added to the LinearLayout with id of myChat?

    – Aaron
    Nov 20 '18 at 2:28
















-1












-1








-1








I want to make a chat layout. I want to put Edittext and Button on the bottom of the screen. I already tried using gravity : bottom and alignParentBottom : true, but it doesn't give any effect about that.



This is my code



<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=".chat">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/friendChat"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Nama"
android:textSize="20dp"
android:paddingTop="10dp"
android:paddingLeft="40dp"
android:textColor="@android:color/white"
android:background="@color/starbuck"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/friendChat"
android:paddingTop="20dp"
android:orientation="horizontal"
android:id="@+id/friendChatContainer"
android:paddingLeft="10dp">

<ImageView
android:id="@+id/avatar"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/avatar" />

<TextView
android:id="@+id/friendChatContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:textSize="16dp"
android:textColor="@android:color/white"
android:text="haloooo"
android:background="@color/starbuck"

/>
</LinearLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/friendChatContainer"
android:paddingTop="20dp"
android:orientation="horizontal"
android:gravity="right"
android:paddingRight="10dp"
android:id="@+id/myChat"
>
<TextView

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:textSize="16dp"
android:textColor="@android:color/white"
android:text="haloooo"
android:background="@color/starbuck"

/>
</RelativeLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/myChat"
android:gravity="bottom">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Write a message"
android:inputType="text"
android:paddingHorizontal="10dp"
android:text="" />

<ImageButton
android:id="@+id/sendChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:scaleType="fitCenter"
android:padding="20dp"
android:layout_marginHorizontal="10dp"
android:background="@drawable/send"/>


</LinearLayout>
</RelativeLayout>

</android.support.constraint.ConstraintLayout>


This is what it looks like with that code :
Layout



The EditText and ImageButton supposed on the bottom of the screen.










share|improve this question
















I want to make a chat layout. I want to put Edittext and Button on the bottom of the screen. I already tried using gravity : bottom and alignParentBottom : true, but it doesn't give any effect about that.



This is my code



<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=".chat">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/friendChat"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Nama"
android:textSize="20dp"
android:paddingTop="10dp"
android:paddingLeft="40dp"
android:textColor="@android:color/white"
android:background="@color/starbuck"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/friendChat"
android:paddingTop="20dp"
android:orientation="horizontal"
android:id="@+id/friendChatContainer"
android:paddingLeft="10dp">

<ImageView
android:id="@+id/avatar"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/avatar" />

<TextView
android:id="@+id/friendChatContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:textSize="16dp"
android:textColor="@android:color/white"
android:text="haloooo"
android:background="@color/starbuck"

/>
</LinearLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/friendChatContainer"
android:paddingTop="20dp"
android:orientation="horizontal"
android:gravity="right"
android:paddingRight="10dp"
android:id="@+id/myChat"
>
<TextView

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:textSize="16dp"
android:textColor="@android:color/white"
android:text="haloooo"
android:background="@color/starbuck"

/>
</RelativeLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/myChat"
android:gravity="bottom">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Write a message"
android:inputType="text"
android:paddingHorizontal="10dp"
android:text="" />

<ImageButton
android:id="@+id/sendChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:scaleType="fitCenter"
android:padding="20dp"
android:layout_marginHorizontal="10dp"
android:background="@drawable/send"/>


</LinearLayout>
</RelativeLayout>

</android.support.constraint.ConstraintLayout>


This is what it looks like with that code :
Layout



The EditText and ImageButton supposed on the bottom of the screen.







android xml android-studio






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 9:29









ppreetikaa

137114




137114










asked Nov 20 '18 at 2:26









muhammad ilham ramadhanmuhammad ilham ramadhan

247




247













  • It should be easy: would android:layout_alignParentBottom="true" work if added to the LinearLayout with id of myChat?

    – Aaron
    Nov 20 '18 at 2:28





















  • It should be easy: would android:layout_alignParentBottom="true" work if added to the LinearLayout with id of myChat?

    – Aaron
    Nov 20 '18 at 2:28



















It should be easy: would android:layout_alignParentBottom="true" work if added to the LinearLayout with id of myChat?

– Aaron
Nov 20 '18 at 2:28







It should be easy: would android:layout_alignParentBottom="true" work if added to the LinearLayout with id of myChat?

– Aaron
Nov 20 '18 at 2:28














3 Answers
3






active

oldest

votes


















1














If you don't want to modify basic structure of layout file, just modify two places as the following comments:



...
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/myChat"
android:layout_alignParentBottom="true" //add this line
android:gravity="bottom">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Write a message"
android:inputType="text"
android:paddingHorizontal="10dp"
android:text="" />
<ImageButton
android:id="@+id/sendChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" //delete this line
android:scaleType="fitCenter"
android:padding="20dp"
android:layout_marginHorizontal="10dp"
android:background="@drawable/ic_launcher_background"/>
</LinearLayout>
...





share|improve this answer































    0














    Why are you using a RelativeLayout inside of your ConstraintLayout.



    Firstly I suggest you use either the Relative Layout or the ConstraintLayout.



    I give you an example for the ConstraintLayout



    <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=".chat">



    <TextView
    android:id="@+id/friendChat"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:text="Nama"
    android:textSize="20dp"
    android:paddingTop="10dp"
    android:paddingLeft="40dp"
    android:textColor="@android:color/white"
    android:background="@color/starbuck"
    app:layout_constraintTop_toTopOf="parent"/>

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/friendChat"
    android:paddingTop="20dp"
    android:orientation="horizontal"
    android:id="@+id/friendChatContainer"
    android:paddingLeft="10dp"
    app:layout_constraintTop_toBottomOf="@id/friendChat">

    <ImageView
    android:id="@+id/avatar"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:src="@drawable/avatar" />

    <TextView
    android:id="@+id/friendChatContent"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginLeft="10dp"
    android:textSize="16dp"
    android:textColor="@android:color/white"
    android:text="haloooo"
    android:background="@color/starbuck"

    />
    </LinearLayout>


    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/myChat"
    android:gravity="bottom"
    app:layout_constraintBottom_toBottomOf="parent">
    <EditText
    android:id="@+id/editText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:ems="10"
    android:hint="Write a message"
    android:inputType="text"
    android:paddingHorizontal="10dp"
    android:text="" />

    <ImageButton
    android:id="@+id/sendChat"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:scaleType="fitCenter"
    android:padding="20dp"
    android:layout_marginHorizontal="10dp"
    android:background="@drawable/send"/>


    </LinearLayout>

    </android.support.constraint.ConstraintLayout>


    This Framework should work for you accordingly. I deleted the one Textview, but you can edit it if you like.
    You do not have to put it into another layout aswell. You can just use the android:constraint... in the textview itself.



    With best regards






    share|improve this answer
























    • I would appreciate if you could accept my answer if it suits your needs!

      – Christian.gruener
      Nov 20 '18 at 4:39



















    0














    Just add android:layout_alignParentBottom="true" in your Bottom LinearLayout and remove android:layout_gravity="center" from send button. The final code is below.



    <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=".chat">

    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
    android:id="@+id/friendChat"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:text="Nama"
    android:textSize="20dp"
    android:paddingTop="10dp"
    android:paddingLeft="40dp"
    android:textColor="@android:color/white"
    android:background="@color/starbuck"/>

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/friendChat"
    android:paddingTop="20dp"
    android:orientation="horizontal"
    android:id="@+id/friendChatContainer"
    android:paddingLeft="10dp">

    <ImageView
    android:id="@+id/avatar"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:src="@drawable/avatar" />

    <TextView
    android:id="@+id/friendChatContent"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginLeft="10dp"
    android:textSize="16dp"
    android:textColor="@android:color/white"
    android:text="haloooo"
    android:background="@color/starbuck"

    />
    </LinearLayout>

    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/friendChatContainer"
    android:paddingTop="20dp"
    android:orientation="horizontal"
    android:gravity="right"
    android:paddingRight="10dp"
    android:id="@+id/myChat"
    >
    <TextView

    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginLeft="10dp"
    android:textSize="16dp"
    android:textColor="@android:color/white"
    android:text="haloooo"
    android:background="@color/starbuck"

    />
    </RelativeLayout>

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:orientation="horizontal"
    android:layout_below="@+id/myChat"
    android:gravity="bottom">
    <EditText
    android:id="@+id/editText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:ems="10"
    android:hint="Write a message"
    android:inputType="text"
    android:paddingHorizontal="10dp"
    android:text="" />

    <ImageButton
    android:id="@+id/sendChat"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scaleType="fitCenter"
    android:padding="20dp"
    android:layout_marginHorizontal="10dp"
    android:background="@drawable/send"/>


    </LinearLayout>
    </RelativeLayout>




    Please avoid if any resource name is changed






    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%2f53385341%2fcant-put-linearlayout-to-the-bottom-of-page-android-studio%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      If you don't want to modify basic structure of layout file, just modify two places as the following comments:



      ...
      <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_below="@+id/myChat"
      android:layout_alignParentBottom="true" //add this line
      android:gravity="bottom">
      <EditText
      android:id="@+id/editText"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:ems="10"
      android:hint="Write a message"
      android:inputType="text"
      android:paddingHorizontal="10dp"
      android:text="" />
      <ImageButton
      android:id="@+id/sendChat"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center" //delete this line
      android:scaleType="fitCenter"
      android:padding="20dp"
      android:layout_marginHorizontal="10dp"
      android:background="@drawable/ic_launcher_background"/>
      </LinearLayout>
      ...





      share|improve this answer




























        1














        If you don't want to modify basic structure of layout file, just modify two places as the following comments:



        ...
        <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/myChat"
        android:layout_alignParentBottom="true" //add this line
        android:gravity="bottom">
        <EditText
        android:id="@+id/editText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:ems="10"
        android:hint="Write a message"
        android:inputType="text"
        android:paddingHorizontal="10dp"
        android:text="" />
        <ImageButton
        android:id="@+id/sendChat"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center" //delete this line
        android:scaleType="fitCenter"
        android:padding="20dp"
        android:layout_marginHorizontal="10dp"
        android:background="@drawable/ic_launcher_background"/>
        </LinearLayout>
        ...





        share|improve this answer


























          1












          1








          1







          If you don't want to modify basic structure of layout file, just modify two places as the following comments:



          ...
          <LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@+id/myChat"
          android:layout_alignParentBottom="true" //add this line
          android:gravity="bottom">
          <EditText
          android:id="@+id/editText"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:ems="10"
          android:hint="Write a message"
          android:inputType="text"
          android:paddingHorizontal="10dp"
          android:text="" />
          <ImageButton
          android:id="@+id/sendChat"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center" //delete this line
          android:scaleType="fitCenter"
          android:padding="20dp"
          android:layout_marginHorizontal="10dp"
          android:background="@drawable/ic_launcher_background"/>
          </LinearLayout>
          ...





          share|improve this answer













          If you don't want to modify basic structure of layout file, just modify two places as the following comments:



          ...
          <LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@+id/myChat"
          android:layout_alignParentBottom="true" //add this line
          android:gravity="bottom">
          <EditText
          android:id="@+id/editText"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:ems="10"
          android:hint="Write a message"
          android:inputType="text"
          android:paddingHorizontal="10dp"
          android:text="" />
          <ImageButton
          android:id="@+id/sendChat"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center" //delete this line
          android:scaleType="fitCenter"
          android:padding="20dp"
          android:layout_marginHorizontal="10dp"
          android:background="@drawable/ic_launcher_background"/>
          </LinearLayout>
          ...






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 '18 at 2:47









          navylovernavylover

          3,40021118




          3,40021118

























              0














              Why are you using a RelativeLayout inside of your ConstraintLayout.



              Firstly I suggest you use either the Relative Layout or the ConstraintLayout.



              I give you an example for the ConstraintLayout



              <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=".chat">



              <TextView
              android:id="@+id/friendChat"
              android:layout_width="match_parent"
              android:layout_height="50dp"
              android:text="Nama"
              android:textSize="20dp"
              android:paddingTop="10dp"
              android:paddingLeft="40dp"
              android:textColor="@android:color/white"
              android:background="@color/starbuck"
              app:layout_constraintTop_toTopOf="parent"/>

              <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/friendChat"
              android:paddingTop="20dp"
              android:orientation="horizontal"
              android:id="@+id/friendChatContainer"
              android:paddingLeft="10dp"
              app:layout_constraintTop_toBottomOf="@id/friendChat">

              <ImageView
              android:id="@+id/avatar"
              android:layout_width="50dp"
              android:layout_height="50dp"
              android:src="@drawable/avatar" />

              <TextView
              android:id="@+id/friendChatContent"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:layout_marginLeft="10dp"
              android:textSize="16dp"
              android:textColor="@android:color/white"
              android:text="haloooo"
              android:background="@color/starbuck"

              />
              </LinearLayout>


              <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/myChat"
              android:gravity="bottom"
              app:layout_constraintBottom_toBottomOf="parent">
              <EditText
              android:id="@+id/editText"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:ems="10"
              android:hint="Write a message"
              android:inputType="text"
              android:paddingHorizontal="10dp"
              android:text="" />

              <ImageButton
              android:id="@+id/sendChat"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:scaleType="fitCenter"
              android:padding="20dp"
              android:layout_marginHorizontal="10dp"
              android:background="@drawable/send"/>


              </LinearLayout>

              </android.support.constraint.ConstraintLayout>


              This Framework should work for you accordingly. I deleted the one Textview, but you can edit it if you like.
              You do not have to put it into another layout aswell. You can just use the android:constraint... in the textview itself.



              With best regards






              share|improve this answer
























              • I would appreciate if you could accept my answer if it suits your needs!

                – Christian.gruener
                Nov 20 '18 at 4:39
















              0














              Why are you using a RelativeLayout inside of your ConstraintLayout.



              Firstly I suggest you use either the Relative Layout or the ConstraintLayout.



              I give you an example for the ConstraintLayout



              <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=".chat">



              <TextView
              android:id="@+id/friendChat"
              android:layout_width="match_parent"
              android:layout_height="50dp"
              android:text="Nama"
              android:textSize="20dp"
              android:paddingTop="10dp"
              android:paddingLeft="40dp"
              android:textColor="@android:color/white"
              android:background="@color/starbuck"
              app:layout_constraintTop_toTopOf="parent"/>

              <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/friendChat"
              android:paddingTop="20dp"
              android:orientation="horizontal"
              android:id="@+id/friendChatContainer"
              android:paddingLeft="10dp"
              app:layout_constraintTop_toBottomOf="@id/friendChat">

              <ImageView
              android:id="@+id/avatar"
              android:layout_width="50dp"
              android:layout_height="50dp"
              android:src="@drawable/avatar" />

              <TextView
              android:id="@+id/friendChatContent"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:layout_marginLeft="10dp"
              android:textSize="16dp"
              android:textColor="@android:color/white"
              android:text="haloooo"
              android:background="@color/starbuck"

              />
              </LinearLayout>


              <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/myChat"
              android:gravity="bottom"
              app:layout_constraintBottom_toBottomOf="parent">
              <EditText
              android:id="@+id/editText"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:ems="10"
              android:hint="Write a message"
              android:inputType="text"
              android:paddingHorizontal="10dp"
              android:text="" />

              <ImageButton
              android:id="@+id/sendChat"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:scaleType="fitCenter"
              android:padding="20dp"
              android:layout_marginHorizontal="10dp"
              android:background="@drawable/send"/>


              </LinearLayout>

              </android.support.constraint.ConstraintLayout>


              This Framework should work for you accordingly. I deleted the one Textview, but you can edit it if you like.
              You do not have to put it into another layout aswell. You can just use the android:constraint... in the textview itself.



              With best regards






              share|improve this answer
























              • I would appreciate if you could accept my answer if it suits your needs!

                – Christian.gruener
                Nov 20 '18 at 4:39














              0












              0








              0







              Why are you using a RelativeLayout inside of your ConstraintLayout.



              Firstly I suggest you use either the Relative Layout or the ConstraintLayout.



              I give you an example for the ConstraintLayout



              <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=".chat">



              <TextView
              android:id="@+id/friendChat"
              android:layout_width="match_parent"
              android:layout_height="50dp"
              android:text="Nama"
              android:textSize="20dp"
              android:paddingTop="10dp"
              android:paddingLeft="40dp"
              android:textColor="@android:color/white"
              android:background="@color/starbuck"
              app:layout_constraintTop_toTopOf="parent"/>

              <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/friendChat"
              android:paddingTop="20dp"
              android:orientation="horizontal"
              android:id="@+id/friendChatContainer"
              android:paddingLeft="10dp"
              app:layout_constraintTop_toBottomOf="@id/friendChat">

              <ImageView
              android:id="@+id/avatar"
              android:layout_width="50dp"
              android:layout_height="50dp"
              android:src="@drawable/avatar" />

              <TextView
              android:id="@+id/friendChatContent"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:layout_marginLeft="10dp"
              android:textSize="16dp"
              android:textColor="@android:color/white"
              android:text="haloooo"
              android:background="@color/starbuck"

              />
              </LinearLayout>


              <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/myChat"
              android:gravity="bottom"
              app:layout_constraintBottom_toBottomOf="parent">
              <EditText
              android:id="@+id/editText"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:ems="10"
              android:hint="Write a message"
              android:inputType="text"
              android:paddingHorizontal="10dp"
              android:text="" />

              <ImageButton
              android:id="@+id/sendChat"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:scaleType="fitCenter"
              android:padding="20dp"
              android:layout_marginHorizontal="10dp"
              android:background="@drawable/send"/>


              </LinearLayout>

              </android.support.constraint.ConstraintLayout>


              This Framework should work for you accordingly. I deleted the one Textview, but you can edit it if you like.
              You do not have to put it into another layout aswell. You can just use the android:constraint... in the textview itself.



              With best regards






              share|improve this answer













              Why are you using a RelativeLayout inside of your ConstraintLayout.



              Firstly I suggest you use either the Relative Layout or the ConstraintLayout.



              I give you an example for the ConstraintLayout



              <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=".chat">



              <TextView
              android:id="@+id/friendChat"
              android:layout_width="match_parent"
              android:layout_height="50dp"
              android:text="Nama"
              android:textSize="20dp"
              android:paddingTop="10dp"
              android:paddingLeft="40dp"
              android:textColor="@android:color/white"
              android:background="@color/starbuck"
              app:layout_constraintTop_toTopOf="parent"/>

              <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/friendChat"
              android:paddingTop="20dp"
              android:orientation="horizontal"
              android:id="@+id/friendChatContainer"
              android:paddingLeft="10dp"
              app:layout_constraintTop_toBottomOf="@id/friendChat">

              <ImageView
              android:id="@+id/avatar"
              android:layout_width="50dp"
              android:layout_height="50dp"
              android:src="@drawable/avatar" />

              <TextView
              android:id="@+id/friendChatContent"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:layout_marginLeft="10dp"
              android:textSize="16dp"
              android:textColor="@android:color/white"
              android:text="haloooo"
              android:background="@color/starbuck"

              />
              </LinearLayout>


              <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/myChat"
              android:gravity="bottom"
              app:layout_constraintBottom_toBottomOf="parent">
              <EditText
              android:id="@+id/editText"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:ems="10"
              android:hint="Write a message"
              android:inputType="text"
              android:paddingHorizontal="10dp"
              android:text="" />

              <ImageButton
              android:id="@+id/sendChat"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:scaleType="fitCenter"
              android:padding="20dp"
              android:layout_marginHorizontal="10dp"
              android:background="@drawable/send"/>


              </LinearLayout>

              </android.support.constraint.ConstraintLayout>


              This Framework should work for you accordingly. I deleted the one Textview, but you can edit it if you like.
              You do not have to put it into another layout aswell. You can just use the android:constraint... in the textview itself.



              With best regards







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 20 '18 at 2:42









              Christian.gruenerChristian.gruener

              258




              258













              • I would appreciate if you could accept my answer if it suits your needs!

                – Christian.gruener
                Nov 20 '18 at 4:39



















              • I would appreciate if you could accept my answer if it suits your needs!

                – Christian.gruener
                Nov 20 '18 at 4:39

















              I would appreciate if you could accept my answer if it suits your needs!

              – Christian.gruener
              Nov 20 '18 at 4:39





              I would appreciate if you could accept my answer if it suits your needs!

              – Christian.gruener
              Nov 20 '18 at 4:39











              0














              Just add android:layout_alignParentBottom="true" in your Bottom LinearLayout and remove android:layout_gravity="center" from send button. The final code is below.



              <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=".chat">

              <RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent">

              <TextView
              android:id="@+id/friendChat"
              android:layout_width="match_parent"
              android:layout_height="50dp"
              android:text="Nama"
              android:textSize="20dp"
              android:paddingTop="10dp"
              android:paddingLeft="40dp"
              android:textColor="@android:color/white"
              android:background="@color/starbuck"/>

              <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/friendChat"
              android:paddingTop="20dp"
              android:orientation="horizontal"
              android:id="@+id/friendChatContainer"
              android:paddingLeft="10dp">

              <ImageView
              android:id="@+id/avatar"
              android:layout_width="50dp"
              android:layout_height="50dp"
              android:src="@drawable/avatar" />

              <TextView
              android:id="@+id/friendChatContent"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:layout_marginLeft="10dp"
              android:textSize="16dp"
              android:textColor="@android:color/white"
              android:text="haloooo"
              android:background="@color/starbuck"

              />
              </LinearLayout>

              <RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/friendChatContainer"
              android:paddingTop="20dp"
              android:orientation="horizontal"
              android:gravity="right"
              android:paddingRight="10dp"
              android:id="@+id/myChat"
              >
              <TextView

              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:layout_marginLeft="10dp"
              android:textSize="16dp"
              android:textColor="@android:color/white"
              android:text="haloooo"
              android:background="@color/starbuck"

              />
              </RelativeLayout>

              <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:orientation="horizontal"
              android:layout_below="@+id/myChat"
              android:gravity="bottom">
              <EditText
              android:id="@+id/editText"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:ems="10"
              android:hint="Write a message"
              android:inputType="text"
              android:paddingHorizontal="10dp"
              android:text="" />

              <ImageButton
              android:id="@+id/sendChat"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:scaleType="fitCenter"
              android:padding="20dp"
              android:layout_marginHorizontal="10dp"
              android:background="@drawable/send"/>


              </LinearLayout>
              </RelativeLayout>




              Please avoid if any resource name is changed






              share|improve this answer




























                0














                Just add android:layout_alignParentBottom="true" in your Bottom LinearLayout and remove android:layout_gravity="center" from send button. The final code is below.



                <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=".chat">

                <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <TextView
                android:id="@+id/friendChat"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:text="Nama"
                android:textSize="20dp"
                android:paddingTop="10dp"
                android:paddingLeft="40dp"
                android:textColor="@android:color/white"
                android:background="@color/starbuck"/>

                <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/friendChat"
                android:paddingTop="20dp"
                android:orientation="horizontal"
                android:id="@+id/friendChatContainer"
                android:paddingLeft="10dp">

                <ImageView
                android:id="@+id/avatar"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:src="@drawable/avatar" />

                <TextView
                android:id="@+id/friendChatContent"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginLeft="10dp"
                android:textSize="16dp"
                android:textColor="@android:color/white"
                android:text="haloooo"
                android:background="@color/starbuck"

                />
                </LinearLayout>

                <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/friendChatContainer"
                android:paddingTop="20dp"
                android:orientation="horizontal"
                android:gravity="right"
                android:paddingRight="10dp"
                android:id="@+id/myChat"
                >
                <TextView

                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginLeft="10dp"
                android:textSize="16dp"
                android:textColor="@android:color/white"
                android:text="haloooo"
                android:background="@color/starbuck"

                />
                </RelativeLayout>

                <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:orientation="horizontal"
                android:layout_below="@+id/myChat"
                android:gravity="bottom">
                <EditText
                android:id="@+id/editText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:ems="10"
                android:hint="Write a message"
                android:inputType="text"
                android:paddingHorizontal="10dp"
                android:text="" />

                <ImageButton
                android:id="@+id/sendChat"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:scaleType="fitCenter"
                android:padding="20dp"
                android:layout_marginHorizontal="10dp"
                android:background="@drawable/send"/>


                </LinearLayout>
                </RelativeLayout>




                Please avoid if any resource name is changed






                share|improve this answer


























                  0












                  0








                  0







                  Just add android:layout_alignParentBottom="true" in your Bottom LinearLayout and remove android:layout_gravity="center" from send button. The final code is below.



                  <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=".chat">

                  <RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent">

                  <TextView
                  android:id="@+id/friendChat"
                  android:layout_width="match_parent"
                  android:layout_height="50dp"
                  android:text="Nama"
                  android:textSize="20dp"
                  android:paddingTop="10dp"
                  android:paddingLeft="40dp"
                  android:textColor="@android:color/white"
                  android:background="@color/starbuck"/>

                  <LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/friendChat"
                  android:paddingTop="20dp"
                  android:orientation="horizontal"
                  android:id="@+id/friendChatContainer"
                  android:paddingLeft="10dp">

                  <ImageView
                  android:id="@+id/avatar"
                  android:layout_width="50dp"
                  android:layout_height="50dp"
                  android:src="@drawable/avatar" />

                  <TextView
                  android:id="@+id/friendChatContent"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:layout_marginLeft="10dp"
                  android:textSize="16dp"
                  android:textColor="@android:color/white"
                  android:text="haloooo"
                  android:background="@color/starbuck"

                  />
                  </LinearLayout>

                  <RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/friendChatContainer"
                  android:paddingTop="20dp"
                  android:orientation="horizontal"
                  android:gravity="right"
                  android:paddingRight="10dp"
                  android:id="@+id/myChat"
                  >
                  <TextView

                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:layout_marginLeft="10dp"
                  android:textSize="16dp"
                  android:textColor="@android:color/white"
                  android:text="haloooo"
                  android:background="@color/starbuck"

                  />
                  </RelativeLayout>

                  <LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_alignParentBottom="true"
                  android:orientation="horizontal"
                  android:layout_below="@+id/myChat"
                  android:gravity="bottom">
                  <EditText
                  android:id="@+id/editText"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"
                  android:ems="10"
                  android:hint="Write a message"
                  android:inputType="text"
                  android:paddingHorizontal="10dp"
                  android:text="" />

                  <ImageButton
                  android:id="@+id/sendChat"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:scaleType="fitCenter"
                  android:padding="20dp"
                  android:layout_marginHorizontal="10dp"
                  android:background="@drawable/send"/>


                  </LinearLayout>
                  </RelativeLayout>




                  Please avoid if any resource name is changed






                  share|improve this answer













                  Just add android:layout_alignParentBottom="true" in your Bottom LinearLayout and remove android:layout_gravity="center" from send button. The final code is below.



                  <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=".chat">

                  <RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent">

                  <TextView
                  android:id="@+id/friendChat"
                  android:layout_width="match_parent"
                  android:layout_height="50dp"
                  android:text="Nama"
                  android:textSize="20dp"
                  android:paddingTop="10dp"
                  android:paddingLeft="40dp"
                  android:textColor="@android:color/white"
                  android:background="@color/starbuck"/>

                  <LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/friendChat"
                  android:paddingTop="20dp"
                  android:orientation="horizontal"
                  android:id="@+id/friendChatContainer"
                  android:paddingLeft="10dp">

                  <ImageView
                  android:id="@+id/avatar"
                  android:layout_width="50dp"
                  android:layout_height="50dp"
                  android:src="@drawable/avatar" />

                  <TextView
                  android:id="@+id/friendChatContent"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:layout_marginLeft="10dp"
                  android:textSize="16dp"
                  android:textColor="@android:color/white"
                  android:text="haloooo"
                  android:background="@color/starbuck"

                  />
                  </LinearLayout>

                  <RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/friendChatContainer"
                  android:paddingTop="20dp"
                  android:orientation="horizontal"
                  android:gravity="right"
                  android:paddingRight="10dp"
                  android:id="@+id/myChat"
                  >
                  <TextView

                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:layout_marginLeft="10dp"
                  android:textSize="16dp"
                  android:textColor="@android:color/white"
                  android:text="haloooo"
                  android:background="@color/starbuck"

                  />
                  </RelativeLayout>

                  <LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_alignParentBottom="true"
                  android:orientation="horizontal"
                  android:layout_below="@+id/myChat"
                  android:gravity="bottom">
                  <EditText
                  android:id="@+id/editText"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"
                  android:ems="10"
                  android:hint="Write a message"
                  android:inputType="text"
                  android:paddingHorizontal="10dp"
                  android:text="" />

                  <ImageButton
                  android:id="@+id/sendChat"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:scaleType="fitCenter"
                  android:padding="20dp"
                  android:layout_marginHorizontal="10dp"
                  android:background="@drawable/send"/>


                  </LinearLayout>
                  </RelativeLayout>




                  Please avoid if any resource name is changed







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 20 '18 at 7:22









                  ppreetikaappreetikaa

                  137114




                  137114






























                      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%2f53385341%2fcant-put-linearlayout-to-the-bottom-of-page-android-studio%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

                      MongoDB - Not Authorized To Execute Command

                      in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

                      How to fix TextFormField cause rebuild widget in Flutter