5

I have recently migrated my listview to recyclerview, so that I could have the effect on the toolbar that disappear to show only tabs / RecyclerView.

Thing is now, when I try to align an element to bottom, that element is getting out of the screen from the bottom.

I have to add like 60dp of margin bottom to fix it. But in my FloatingActionButton, those 60dp affect animation, so I don't like it so much...

Does anyone know the trick???

Here is my code:

First Tab

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#CCC">


<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/lista_tiendas"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="5dp"
    android:divider="@android:color/transparent"
    android:dividerHeight="1.0sp" />

<com.melnykov.fab.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_marginTop="16dp"
    android:layout_marginLeft="16dp"
    android:layout_marginRight="16dp"
    android:layout_marginBottom="76dp"
    android:src="@drawable/ic_add_white_24dp"
    app:fab_type="normal"
    app:fab_shadow="true"
    app:fab_colorNormal="@color/spg_rosa"
    app:fab_colorPressed="@color/spg_rosa_dark"
    />


<!--<android.support.design.widget.FloatingActionButton-->
<!--android:id="@+id/fab"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_gravity="right|bottom"-->
<!--android:src="@drawable/ic_add_white_48dp"-->
<!--app:backgroundTint="@color/spg_rosa"-->
<!--android:transitionName="@string/transition_add_pdv"-->
<!--app:borderWidth="0dp"-->
<!--app:elevation="8dp"-->
<!--app:fabSize="normal" />-->

</FrameLayout>

Second tab

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="50">


<com.google.android.gms.maps.MapView
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<TextView
    android:id="@+id/maps_unavailable"
    style="@style/placeholder_text"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:text="@string/maps_unavailable"
    android:visibility="gone" />

<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="@dimen/map_pager_height"
    android:layout_gravity="bottom"
    android:layout_marginBottom="55dp"/>


</FrameLayout>

And the CoordinatorLayout

<android.support.design.widget.CoordinatorLayout   xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">


<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.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

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

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


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

Any Idea???

Juliatzin
  • 18,455
  • 40
  • 166
  • 325

0 Answers0