Overlay Floating Button in Linear Layout



I have a layout like this:


enter image description here


But as you can see, the Floating Button is not overlaying the edit text. Is there any way to do this in Linear Layout? (I cannot use other layouts).


I have seen many answer on SO but all of them use either Relative Layout or Frame Layout.


Here is my xml (the floating button is at the end) -



<LinearLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="10"
android:orientation="vertical"
tools:context=".Start">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">

<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="New Button"
android:id="@+id/button" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">

<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="New Button"
android:id="@+id/button2" />

</LinearLayout>

<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:layout_gravity="center_horizontal"
android:id="@+id/editText" />

<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:layout_gravity="center_horizontal"
android:id="@+id/editText2" />

<!--Overlay this image -->

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/ic_mic"
android:layout_gravity="right" />

</LinearLayout>


Here is how I want it to look -


enter image description here


No comments:

Post a Comment