Search code examples
androidmaterial-designandroid-coordinatorlayoutlayout-anchor

Adding a button on the baseline of a layout


How to place a button on the baseline of a layout as shown in the image below

enter image description here


Solution

  •  <android.support.design.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
    
            <android.support.v7.widget.CardView
                android:id="@+id/cardView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:cardCornerRadius="7dp"
                app:cardElevation="22dp">
    
    
            </android.support.v7.widget.CardView>
    
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_anchor="@+id/cardView"
                app:srcCompat="@drawable/ic_facebook"
                app:layout_anchorGravity="center|bottom" />
    
        </android.support.design.widget.CoordinatorLayout>