I have implemented simple relative layout for chat inside one of fragments layout called "Chat". The problem is that when I click EditText to type message, Linear Layout for sending messages disappears and messages are superimposed on the items above(I want them no to overlay any element except recycler view).
How to fix it?
Below I put the code of layout and screenshots Layout and Layout after click
<RelativeLayout 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=".ChatFragment">
<Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:theme="#style/ThemeOverlay.AppCompat.Light"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/start_at_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Start at"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</Toolbar>
<LinearLayout
android:id="#+id/chat_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/white"
android:gravity="center_horizontal"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">
<ImageButton
android:id="#+id/attachBtn"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#null"
android:src="#drawable/ic_attach_file"
tools:ignore="SpeakableTextPresentCheck" />
<EditText
android:id="#+id/messageEt"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#null"
android:hint="Start typing..."
android:inputType="textCapSentences|textMultiLine" />
<ImageButton
android:id="#+id/send_btn"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#null"
android:src="#drawable/ic_send"
tools:ignore="SpeakableTextPresentCheck" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recycler_view_chat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/chat_layout"
android:layout_below="#+id/toolbar"
android:background="#AEFFFFFF"
tools:listitem="#layout/message_left" />
</RelativeLayout>
Related
i have two recyclers view in Fragment bottom sheet
the bottom sheet keeps moving with the recyceler view so that i will not be able to scroll the recycler views here is my code
`
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.LinearLayoutCompat
android:id="#+id/expandable_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<com.plus.medfastplus.customViews.views.CustomBoldTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="Press to manage your already assisted requests?"
android:textColor="#color/colorPrimary" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="40dp"
android:layout_height="40dp"
android:gravity="center">
<ImageView
android:id="#+id/imageView"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="#drawable/ic_arrow_down" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
<net.cachapa.expandablelayout.ExpandableLayout
android:id="#+id/expandale_view"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginStart="20dp"
app:el_duration="1000"
app:el_expanded="false"
app:el_parallax="0.5">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/referral_recycler_view"
android:layout_width="match_parent"
android:fadeScrollbars="false"
android:layout_height="150dp"
/>
</net.cachapa.expandablelayout.ExpandableLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/colorPrimary" />
<com.plus.medfastplus.customViews.views.CustomRegularTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="What kind of assists you need?"
android:textColor="#color/black" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/services_recycler_view"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
/>
<com.plus.medfastplus.customViews.views.CustomBoldButton
android:id="#+id/back_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/rounded_button_abit_blue"
android:gravity="center"
android:text="#string/back"
android:textColor="#color/white" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
`
i have tried to add
nestedScrollingEnabled="false"
this seems to be works with only the other recycler view and the first one will not work
I have on activity in which i need to add one horizontal list for showing the formats of image which should be appear in the lower part of the activity. Here is my xml file.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:fitsSystemWindows="true"
tools:context=".view.quickaction.QuickActionVideoActivity">
<RelativeLayout
android:id="#+id/quick_action_video_header_contatiner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="#+id/quick_action_video_close"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="20dp"
android:text="#string/button_cancel"
android:textColor="#color/express_purple"
android:textSize="18dp" />
<TextView
android:id="#+id/quick_action_video_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/quick_action_video_close"
android:layout_marginTop="30dp"
android:fontFamily="#font/adobe_clean_bold"
android:text="#string/quick_action_resize_video_header"
android:textColor="#color/black_alpha_85"
android:textSize="32dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/quick_action_video_title"
android:text="#string/powered_by_magicX"
android:textColor="#color/black_alpha_85"
android:textSize="14dp" />
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/zoom_surface"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="15dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="15dp"
android:background="#drawable/rounded_rectangle_rect"
android:visibility="visible"
app:layout_constraintDimensionRatio="H,5:4"
app:layout_constraintEnd_toStartOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/quick_action_video_header_contatiner">
<com.otaliastudios.zoom.ZoomSurfaceView
android:id="#+id/surface_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"
android:layout_marginBottom="25dp"
app:horizontalPanEnabled="true"
app:verticalPanEnabled="true"
app:zoomEnabled="true" />
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:id="#+id/relativeLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/zoom_surface"
app:layout_constraintBottom_toTopOf="#id/relativeLayout2"
tools:ignore="MissingConstraints">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rvList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal"
app:layout_constrainedHeight="true"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<Button
android:id="#+id/quick_action_video_save_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_weight="1"
android:background="#drawable/button_bg_rounded_corners"
android:fontFamily="#font/adobe_clean_bold"
android:text="#string/save_share_option"
android:textColor="#color/white_alpha_80" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
It should look like this:
But this recyler-view while loading taking the whole space of the activity and one header also. Can you tell me what is wrong in this? Can recyler-view won't be able to host inside this view.
The issue is that you don't have a top to bottom of constraint and have set the height as match constraints.. However for layouts like this i have a few tips..
do the layouts first with constant heights like 200 dp or so and change them later
follow a top to bottom or a bottom to top approach that is one view at the top and everything else is done taking that as anchor
use constraint layouts throughout. You don't need any other layout type if you're using constraint layout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/zoom_surface"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="15dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="15dp"
android:background="#drawable/rounded_rectangle_rect"
android:visibility="visible"
app:layout_constraintDimensionRatio="H,5:4"
app:layout_constraintEnd_toStartOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/quick_action_video_header_contatiner"
app:layout_constraintBottom_toTopOf=" ">add the suitable id
<com.otaliastudios.zoom.ZoomSurfaceView
android:id="#+id/surface_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"
android:layout_marginBottom="25dp"
app:horizontalPanEnabled="true"
app:verticalPanEnabled="true"
app:zoomEnabled="true" />
</androidx.constraintlayout.widget.ConstraintLayout>
I have activity with horizontal scroll view to display four button's. Below located FrameLayout witch display fragment based on what button was clicked. Second and Fourth button shows RecyclerView with a lot of data. How can i make this horizontal scroll view to stay on top below or in place of Toolbar, so i can switch between fragments withount going all the way up?
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/smoky_white"
android:orientation="vertical"
tools:context=".o_kaznau">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/purple_200"
android:elevation="4dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:title="О КазНАИУ" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/toolbar"
app:layout_constraintVertical_bias="1.0">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="#+id/imageView11"
android:layout_width="match_parent"
android:layout_height="230dp"
android:scaleType="fitXY"
android:src="#drawable/im_maincorpus1"/>
<HorizontalScrollView
android:id="#+id/horizontalScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="#+id/btnAbout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/about_btn"
android:onClick="aboutAbout"
android:textSize="15sp"
android:textAllCaps="false"
android:text="Об университете" />
<Button
android:id="#+id/btnRyk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/about_btn"
android:onClick="aboutRyc"
android:textSize="15sp"
android:textAllCaps="false"
android:text="Руководство" />
<Button
android:id="#+id/btnPolitika"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/about_btn"
android:onClick="aboutPolitika"
android:textSize="15sp"
android:textAllCaps="false"
android:text="Политика" />
<Button
android:id="#+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/about_btn"
android:onClick="aboutYstav"
android:textSize="15sp"
android:textAllCaps="false"
android:text="Устав" />
</LinearLayout>
</HorizontalScrollView>
<FrameLayout
android:id="#+id/aboutFL"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
I have an activity that contains one fragment added by the include tag (at the top of the activity) and one main central fragment. The main fragment also contains the editText widget. When I click on the edittext keyboard it is displayed and based on the window chosen, the SoftInputMode keyboard moves the window upwards (the upper fragment disappears behind the screen) or overlaps the buttons below the keyboard on the main fragment. (scrolling does not appear in both cases).
I need scrollable fragment window, but its impossible? How?
Xmls:
Activity:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/bg_second"
android:keepScreenOn="true">
<FrameLayout
android:id="#+id/fl_work_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom|right|end"
tools:ignore="RtlHardcoded" />
<include layout="#layout/view_menu_main" />
Main fragment:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="#+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="#id/tv_tariff_label"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/textInputLayout">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/space_large_m"
android:background="?attr/bg_main"
android:minHeight="120dp"
android:paddingStart="#dimen/space_medium_xl"
android:paddingTop="#dimen/space_medium_l"
android:paddingEnd="#dimen/space_medium_xl" />
<TextView
android:id="#+id/tv_empty_point"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/space_medium_s"
android:text="#string/road_to_empty_text"
android:textAlignment="center"
android:textColor="?attr/text_main"
tools:textColor="#color/black" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/space_medium_xl"
android:tint="#android:color/white"
app:backgroundTint="#color/bg_button_light"
app:layout_anchor="#id/rv_border"
app:layout_anchorGravity="bottom|right|end"
app:srcCompat="#android:drawable/ic_input_add" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="70dp"
android:paddingStart="#dimen/space_small_l"
android:paddingEnd="#dimen/space_small_l"
android:theme="#style/TextInputLayout"
app:layout_constraintBottom_toTopOf="#id/tv_tariff_label"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="+7949919">
<EditText
android:id="#+id/phone_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/phone_number_of_client"
android:importantForAutofill="no"
android:inputType="phone"
android:maxLength="15"
android:maxLines="1"
android:singleLine="true"
android:textColor="?attr/text_main"
android:textColorHighlight="#android:color/darker_gray"
android:textColorHint="#android:color/darker_gray"
tools:textColor="#color/black" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="#+id/tv_tariff_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:padding="#dimen/space_medium_s"
android:singleLine="true"
android:text="#string/work_main_tariff"
android:textColor="?attr/text_main"
android:textSize="#dimen/font_size_huge"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/textInputLayout"
tools:textColor="#color/black" />
<LinearLayout
android:id="#+id/ll_tariff_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_second"
android:orientation="horizontal"
android:weightSum="3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/tv_tariff_label">
<TextView
android:id="#+id/tv_tariff"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1.8"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:paddingStart="#dimen/space_medium_s"
android:paddingEnd="#dimen/space_medium_s"
android:tag="tariff"
android:textColor="?attr/text_main"
android:textSize="#dimen/font_size_huge"
tools:text="My tariff"
tools:textColor="#color/black" />
<Button
android:id="#+id/add_opt_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:background="#drawable/custom_button_green"
android:text="#string/options_title"
android:textColor="?attr/text_button"
android:textSize="#dimen/font_size_large"
android:visibility="invisible"
tools:textColor="#color/white" />
<ProgressBar
android:id="#+id/p_bar_options"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="4dp"
android:layout_weight="1.2"
android:padding="4dp"
android:text="#string/options_title"
android:textColor="?attr/text_button"
android:textSize="#dimen/font_size_large"
android:theme="#style/accentStyle"
android:visibility="gone"
tools:textColor="#color/white" />
</LinearLayout>
<Button
android:id="#+id/btn_start_work"
android:layout_width="wrap_content"
android:layout_height="#dimen/button_height"
android:layout_gravity="center_horizontal"
android:layout_marginTop="50dp"
android:background="#drawable/custom_button_green"
android:text="#string/work_btn_begin"
android:textColor="?attr/text_button"
android:textSize="#dimen/font_size_large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/ll_tariff_view"
tools:textColor="#color/white" />
<ProgressBar
android:id="#+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:theme="#style/accentStyle"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/ll_tariff_view"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
You can use below code into Manifest file for your activity, I think it should resolve your problem
android:windowSoftInputMode="adjustPan|adjustResize"
I have a LinearLayout with a Toolbar inside it and an EditText and a Button. I'm using images to express what i want, it is simple:
This is what I have right now: (the ImageButton with the logo is in the Toolbar)
And this is what I want to achieve: (The ImageButton with the logo is between the Toolbar and the LinearLayout)
This is my XML code for the layout file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/secondColor"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/mainColor"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:paddingLeft="-10dp">
<ImageButton
android:id="#+id/btnMenu"
style="#android:style/Widget.DeviceDefault.ImageButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#null"
android:src="#drawable/menu_principal" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_weight="5"
android:fontFamily="#font/roboto_medium"
android:text="#string/app_name"
android:textAlignment="center"
android:textColor="#android:color/white"
android:textSize="24sp" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="false"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:background="#null"
android:scaleType="fitXY"
android:src="#drawable/spotify_logo" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:hint="#string/editReminderTitleHint"
/>
<Button
android:id="#+id/button"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
You can achieve this by changing your LinearLayout top-level view into a ConstraintLayout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
<EditText
android:id="#+id/edit"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="#+id/toolbar"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:hint="Reminder title"/>
<Button
android:id="#+id/button"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="#+id/edit"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:text="BUTTON"/>
<ImageButton
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintTop_toBottomOf="#+id/toolbar"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="#+id/toolbar"
app:layout_constraintEnd_toEndOf="parent"/>
</android.support.constraint.ConstraintLayout>
The important part here is that you constrain both the top and bottom of the ImageButton to the bottom of the Toolbar. This will center it on the bottom edge of the toolbar.
Note that I didn't set a special background for my example ImageButton, but you can make it a circle and it will work just fine.