distance 0 between a LinearLayout and a FloatingActionButton within a Scrollview

1

How can I leave a LinearLayout and FloatingActionButton inside a Scrollview with no distance between them. For example convert image one to image two

  

     

image 1

     

     

image 2

Code xml

    <ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true">




    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true"
        android:layout_marginTop="50dp"
        android:layout_margin="15dp"

        android:background="@drawable/notInicio_1"
        android:orientation="vertical">










        <android.support.design.widget.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_gravity="bottom|end"
            app:backgroundTint="#CCFFFFFF"
            app:backgroundTintMode="src_in"
            app:srcCompat="@drawable/xxxx"></android.support.design.widget.FloatingActionButton>



    </LinearLayout>


</ScrollView>

I hope you can understand my doubt, Thank you ..

    
asked by Neil 13.12.2017 в 01:03
source

2 answers

1

In this case you can do two things:

1- Remove the margin from LinearLayout .

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentBottom="true"
    android:layout_alignParentStart="true"
    android:background="@drawable/notInicio_1"
    android:orientation="vertical">

   ...

</LinearLayout>

2- Force the FloatingActionButton to move more to the left, assigning its layout_marginLeft a negative value.

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:layout_gravity="bottom|end"
    app:backgroundTint="#CCFFFFFF"
    app:backgroundTintMode="src_in"
    app:srcCompat="@drawable/xxxx"
    android:layout_marginLeft="-5dp"
</android.support.design.widget.FloatingActionButton>
    
answered by 13.12.2017 в 01:30
-2

It is enough to eliminate the margin specified by the LinearLayout :

  android:layout_marginTop="50dp"
  android:layout_margin="15dp"

would look like this:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentBottom="true"
    android:layout_alignParentStart="true"


    android:background="@drawable/notInicio_1"
    android:orientation="vertical">

The FloatingActionButton would be displayed like this:

    
answered by 13.12.2017 в 01:49