I have went through every question on Stack Overflow to place a view at the intersection of two layouts (ultimate question: How can I add the new "Floating Action Button" between two widgets/layouts) but I am seeing strange behavior while using the suggested answer.
My circularView always gets placed at top left corner of cardView, and I am not sure why this is happening. Please find the xml below:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context="com.phandaarpit.androidrecyclertutorial.MainActivity">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="250dp"
app:cardUseCompatPadding="true"
app:cardCornerRadius="5dp">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/im_pic"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="?attr/colorControlHighlight"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/profile_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
<TextView
android:id="@+id/profile_sub_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</LinearLayout>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="2dp"
app:layout_anchor="@id/im_pic"
app:layout_anchorGravity="bottom|left"/>
</android.support.design.widget.CoordinatorLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
I am trying to populate this view into RecyclerView and i am getting the below output. FAB is completely out of order on some and placed correctly on some.