Move Floating Action Button, which is on an Android Edittext

0

I have a layout with several edittext, the case that the fab is hiding part of the edittext so at the time of writing it does not let me see what I'm writing in the edittext, there will be some way to move it just when the focus of the edittext is called .

I would need the full edittext to be shown and if it is possible to roll the fab down Thank you.

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

</android.support.design.widget.AppBarLayout>

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    android:layout_below="@+id/appbar"
    android:layout_alignLeft="@+id/pager"
    android:layout_alignStart="@+id/pager"
    android:translationZ="0dp" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingTop="@dimen/view_spacing_small"
    android:id="@+id/layoutinclude">
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:layout_marginTop="55dp">

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/sc"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/material_gray_200"
        android:fillViewport="true"
        android:fitsSystemWindows="true">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingTop="@dimen/view_spacing_small"
            android:id="@+id/layoutinclude4">
            <include layout="@layout/nombre"  android:id="@+id/name_one"/>
            <include layout="@layout/radiob"/>
            <include layout="@layout/nombre_em"  android:id="@+id/test3"/>
            <include layout="@layout/radio_inst_pub_priv" android:id="@+id/test1" />
            <include layout="@layout/e_persona_d" android:id="@+id/test2" />
            <include layout="@layout/e_persona_d_two" android:id="@+id/test4" />
        </LinearLayout>
    </ScrollView>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    android:tint="@android:color/white"
    app:srcCompat="@drawable/send" />

   </android.support.design.widget.CoordinatorLayout>

    
asked by Josee Naava 26.09.2017 в 22:23
source

2 answers

0

Try to remove the Floating Button from the CoordinatorLayout, so that it is outside the CardView:

    <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

</android.support.design.widget.AppBarLayout>

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    android:layout_below="@+id/appbar"
    android:layout_alignLeft="@+id/pager"
    android:layout_alignStart="@+id/pager"
    android:translationZ="0dp" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingTop="@dimen/view_spacing_small"
    android:id="@+id/layoutinclude">
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:layout_marginTop="55dp">

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/sc"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/material_gray_200"
        android:fillViewport="true"
        android:fitsSystemWindows="true">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingTop="@dimen/view_spacing_small"
            android:id="@+id/layoutinclude4">
            <include layout="@layout/nombre"  android:id="@+id/name_one"/>
            <include layout="@layout/radiob"/>
            <include layout="@layout/nombre_em"  android:id="@+id/test3"/>
            <include layout="@layout/radio_inst_pub_priv" android:id="@+id/test1" />
            <include layout="@layout/e_persona_d" android:id="@+id/test2" />
            <include layout="@layout/e_persona_d_two" android:id="@+id/test4" />
        </LinearLayout>
    </ScrollView>
</LinearLayout>

   </android.support.design.widget.CoordinatorLayout>

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    android:tint="@android:color/white"
    app:srcCompat="@drawable/send" />

If it does not work like this, then try to place a RelativeLayout:

    <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

</android.support.design.widget.AppBarLayout>

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    android:layout_below="@+id/appbar"
    android:layout_alignLeft="@+id/pager"
    android:layout_alignStart="@+id/pager"
    android:translationZ="0dp" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingTop="@dimen/view_spacing_small"
    android:id="@+id/layoutinclude">
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:layout_marginTop="55dp">

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/sc"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/material_gray_200"
        android:fillViewport="true"
        android:fitsSystemWindows="true">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingTop="@dimen/view_spacing_small"
            android:id="@+id/layoutinclude4">
            <include layout="@layout/nombre"  android:id="@+id/name_one"/>
            <include layout="@layout/radiob"/>
            <include layout="@layout/nombre_em"  android:id="@+id/test3"/>
            <include layout="@layout/radio_inst_pub_priv" android:id="@+id/test1" />
            <include layout="@layout/e_persona_d" android:id="@+id/test2" />
            <include layout="@layout/e_persona_d_two" android:id="@+id/test4" />
        </LinearLayout>
    </ScrollView>
</LinearLayout>

   </android.support.design.widget.CoordinatorLayout>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    android:tint="@android:color/white"
    app:srcCompat="@drawable/send" />

</RelativeLayout>
    
answered by 26.09.2017 в 22:40
0

What happens in your view if you put the fab between the end of the scroll and the end of LinearLayout?

</ScrollView>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:tint="@android:color/white"
        />


</LinearLayout> 

You can add the include layout then replace them with EditText and I do not see the same problem.

    
answered by 27.09.2017 в 13:54