Floating action button displaying on top right instead of bottom right android - android

This is my parent layout where i am including FAB.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="#+id/coordinatorLayout"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#color/primary"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"/>
<android.support.design.widget.TabLayout
android:id="#+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/toolbar"
android:background="#color/primary"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
app:tabIndicatorColor="#android:color/white"
app:tabIndicatorHeight="4dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
<android.support.v4.view.ViewPager
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tab_layout"
android:paddingTop="20dp"
android:background="#color/windowBackground"
android:layout_above="#id/bottomButtons"
>
</android.support.v4.view.ViewPager>
</RelativeLayout>
<include layout="#layout/floating_button"/>
</android.support.design.widget.CoordinatorLayout>
<fragment
android:id="#+id/fragment_navigation_drawer"
android:name="com.wokoshop.sony.app.FragmentDrawer"
android:layout_width="#dimen/nav_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="#layout/fragment_navigation_drawer"
tools:layout="#layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>
This is actual FAB layout.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:clickable="true"
android:src="#drawable/cart"
android:layout_margin="20dp"
app:elevation="6dp" />
</FrameLayout>
This FAB is displaying in top right in layout. I want to display it on bottom right.
Can anyone help me on this?

Include your FAB layout in your parent layout giving layout_alignParentBottom property true:
<include layout="#layout/activity_dialog"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
Also try to change CoordinatorLayout android:layout_height="fill_parent"
:
<android.support.design.widget.CoordinatorLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:id="#+id/coordinatorLayout"
android:orientation="vertical">

Remove the <include> tag.
Place your FAB in its place with the <anchor> tag:
app:layout_anchorGravity="bottom|right|end"
<android.support.design.widget.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchorGravity="bottom|right|end"
android:clickable="true"
android:src="#drawable/cart"
android:layout_margin="20dp"
app:elevation="6dp" />
If you still aren't winning, revise your layout by referring to this: FAB in the corner.

Related

FAB button go behind admob ads in android 4.0+

I am trying to place fab button above adview but in android 4.0+ fab button go's behind even if i define layout_above="#+id/ad_view"
Here is my code in xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scrollbars="none"
android:background="#FFFAFAFA"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout
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">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
</FrameLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="#+id/frame_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/appbar"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<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_above="#+id/ad_view"
android:layout_margin="#dimen/fab_margin"
android:src="#android:drawable/ic_dialog_email" />
<com.google.android.gms.ads.AdView
android:id="#+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:adSize="FULL_WIDTHx50"
app:adUnitId="#string/banner_ad_unit_id" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#fF312B35"
android:fitsSystemWindows="true"
android:scrollbars="none"
app:headerLayout="#layout/nav_header"
app:itemIconTint="#f3ae1b"
app:itemTextAppearance="#style/TextAppearance.AppCompat.Medium"
app:itemTextColor="#color/White"
app:menu="#menu/menu_drawer"
app:theme="#style/DrawerStyle" />
</android.support.v4.widget.DrawerLayout>
Any idea?
Relative layout inflates the Views in the order you have declared it. To know more you can use Systrace. It will display how the views are rendered. Replace your code by below and let me know by accepting the answer if it helps. Thanks
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<com.google.android.gms.ads.AdView
android:id="#+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:adSize="FULL_WIDTHx50"
app:adUnitId="#string/banner_ad_unit_id" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_above="#+id/ad_view"
android:layout_margin="#dimen/fab_margin"
android:src="#android:drawable/ic_dialog_email" />
</RelativeLayout>

How can i put the element RecyclerView under the element Toolbar in the Android Layout file?

Hey i want in my android app that the recyclerlistview and the floatingActionButton not cut the toolbar. Here is my Layout:
<android.support.design.widget.CoordinatorLayout
android:id="#+id/main_content"
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">
<include
layout="#layout/toolbar_task_layout">
</include>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerView_task"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
app:layout_anchor="#id/recyclerView_task">
</android.support.v7.widget.RecyclerView>
<android.support.design.widget.FloatingActionButton
android:id="#+id/floatingActionButton_task_openDialog_"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="#drawable/ic_add_black_36dp"
app:layout_anchor="#id/recyclerView_task"
android:clickable="true"
app:fabSize="normal"
app:layout_anchorGravity="bottom|right|end"/>
</android.support.design.widget.CoordinatorLayout>
Here you can see the problem:
Update:
Here is the toolbar layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar 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="wrap_content"
android:id="#+id/toolbar_task"
android:layout_alignParentTop="true"
android:background="?attr/colorPrimary"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
app:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0 items selected"
android:id="#+id/counter_task"
android:textSize="18dp"
android:textColor="#ffffff"
android:textStyle="bold" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
Try replacing your <include layout="#layout/toolbar_task_layout"></include>
with this:
<include layout="#layout/toolbar_task_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
EDIT: I assume you also want your FAB to be on the bottom right since this is the norm, try setting android:layout_alignParentBottom="true" and android:layout_alignParentRight="true" in your FAB and make the RecyclerViews height match_parent
try this make your toolbar android:layout_height to android:layout_height="?attr/actionBarSize"
<android.support.v7.widget.Toolbar
android:id="#+id/ac_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="exitUntilCollapsed"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" >
Use below code:
<android.support.design.widget.CoordinatorLayout
android:id="#+id/main_content"
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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="#layout/toolbar_task_layout"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerView_task"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="0dp"
app:layout_anchor="#id/recyclerView_task"
android:layout_below="#+id/toolbar_task"/>
</RelativeLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/floatingActionButton_task_openDialog_"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="#mipmap/ic_launcher"
app:layout_anchor="#id/recyclerView_task"
android:clickable="true"
app:fabSize="normal"
app:layout_anchorGravity="bottom|right|end"/></android.support.design.widget.CoordinatorLayout>
I hope this will help.....

Row of Listview hidden

i need to create a listview into a framelayout.
This is my code:
<FrameLayout
android:id="#+id/layout_ejercicios"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_alignParentStart="true"
android:layout_below="#+id/layout_info"
android:orientation="vertical">
<ListView
android:id="#+id/listViewEjercicios"
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>
<include
android:id="#+id/tool_bar_ejercicios"
layout="#layout/toolbar" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/fabCrearEntrenamiento"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:clickable="true"
android:src="#drawable/ic_action_add"
app:fabSize="normal"
app:layout_anchor="#id/layout_ejercicios"
app:layout_anchorGravity="bottom|right|end" />
</FrameLayout>
It works almost fine but the first row always is hidden by the toolbar.
The rest rows look good.
I try to add padding_top in the row_layout.xml, but is no a solution.
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rowTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="21sp" >
</TextView>
How can i do that?
try this;
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/holo_light_background"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:id="#+id/bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<include
android:id="#+id/tool_bar_ejercicios"
layout="#layout/toolbar" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="#+id/layout_ejercicios"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_alignParentStart="true"
android:layout_below="#+id/layout_info"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:orientation="vertical">
<ListView
android:id="#+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/bar"/>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fabCrearEntrenamiento"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:clickable="true"
android:src="#drawable/ic_action_add"
app:fabSize="normal"
app:layout_anchor="#id/layout_ejercicios"
app:layout_anchorGravity="bottom|right|end" />
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
You used a FrameLayout. Yes, all views overlap in a FrameLayout. Use a LinearLayout because you have set orientation="vertical"
You should put Toolbar above other things
CoordinatorLayout would be better
For example,
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/tool_bar_ejercicios"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<!-- Some other layout behind the Action Button -->
<include layout="#layout/list_view"/>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fabCrearEntrenamiento"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right|end"
android:layout_margin="#dimen/fab_margin"
android:src="#drawable/ic_action_add"/>
</android.support.design.widget.CoordinatorLayout>

FAB (floating action button) doesn't float

I've tried to use the floatingactionbutton element but it doesn't float in UI layout, the floating button occupies part of the layout and isn't over the component, in my case is a viewpager,
button doesn't float
this is my layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.frases.frases.FraseMain"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/appbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" >
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="#+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"/>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#android:color/white" />
<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:src="#android:drawable/ic_dialog_email" />
</LinearLayout>
It's because you are using LinearLayout as the root layout. You need FrameLayout to stack elements over one another, and FAB needs to be the last child node because it needs to stay on top of every other views.
<FrameLayout>
<LinearLayout>
...
</LinearLayout>
<!-- FAB be the last node inside FrameLayout here -->
<android.support.design.widget.FloatingActionButton />
</FrameLayout>
I don't think you have to use coordinator layout, you can simply use floating button with below code as well.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/dashboard_bg"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- here you can have your viewpager -->
<android.support.design.widget.FloatingActionButton
android:id="#+id/dashboardShowActionsFab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:elevation="4dp"
app:fabSize="normal"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="26dp"
android:layout_marginBottom="16dp" />
</RelativeLayout>
Hope this helps.
use CoordinatorLayout like below:
<android.support.design.widget.CoordinatorLayout
android:id="#+id/main_content"
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.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/appbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" >
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="#+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"/>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#android:color/white" />
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="#drawable/ic_done"
app:layout_anchor="#id/lvToDoList"
app:layout_anchorGravity="bottom|right|end" />
</android.support.design.widget.CoordinatorLayout>

button not displaying in bottom of activity - android

This is my layout file.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="#+id/coordinatorLayout"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_alignParentTop="true"/>
<android.support.design.widget.TabLayout
android:id="#+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/toolbar"
android:background="#color/primary"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
app:tabIndicatorColor="#android:color/white"
app:tabIndicatorHeight="4dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tab_layout"
android:layout_above="#+id/floating_button"
android:background="#color/windowBackground"
android:paddingLeft="30dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
<Button android:id="#+id/floating_button"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
android:text="Go to Shopping Cart"
android:theme="#style/MyButton"/>
</android.support.design.widget.CoordinatorLayout>
<fragment
android:id="#+id/fragment_navigation_drawer"
android:name="com.wokoshop.sony.fragment.FragmentDrawer"
android:layout_width="#dimen/nav_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="#layout/fragment_navigation_drawer"
tools:layout="#layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>
I am trying to display a button bottom of the activity. But it is not displaying at all.
Can someone help me what i am missing?
I think you have several minor issues that causes your problem.
1) You're trying to use the cooridnator layout as a relative layout, so the buttons alignParentBottom won't have any effect.
2) Orientation on the coordinator layout is a linear layout property and would have no effect.
3) The coordinator layout or anything within it doesn't use the full parent, all of them are only wrap_parent.
From reading your layout I think you'd want something like this:
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="#+id/appBarlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Whatever views you want here, your tablayout etc-->
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:layout_below="#+id/appBarlayout"
android:layout_above="#+id/button"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v4.view.ViewPager>
<Button
android:id="#+id/button"
android:text="Hey"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>

Categories

Resources