Scroll Bar is not Working in Android - android-layout

I want to display 5 graphs in a singe screen,I have Added scroll bar view,but its not working for me. Could you please help us.Below is my Code .
This is my XML file .
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/chart0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:id="#+id/chart1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:id="#+id/chart2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:id="#+id/chart3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
</ScrollView>
i have 4 liner Layout to display the graph .And one main layout which will contain all the 4 linear layout.

try this codes this will work perfectly for you
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/chart0"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#android:color/holo_red_dark"
android:orientation="horizontal" />
<LinearLayout
android:id="#+id/chart1"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#android:color/holo_green_dark"
android:orientation="horizontal"
android:paddingBottom="#dimen/_16sdp"
android:paddingTop="#dimen/_16sdp" />
<LinearLayout
android:id="#+id/chart2"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#android:color/darker_gray"
android:orientation="horizontal"
android:paddingBottom="#dimen/_16sdp"
android:paddingTop="#dimen/_16sdp" />
<LinearLayout
android:id="#+id/chart3"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#android:color/holo_orange_dark"
android:orientation="horizontal"
android:paddingBottom="#dimen/_16sdp"
android:paddingTop="#dimen/_16sdp" />
<LinearLayout
android:id="#+id/chart4"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#android:color/holo_blue_dark"
android:orientation="horizontal"
android:paddingBottom="#dimen/_16sdp"
android:paddingTop="#dimen/_16sdp" />
</LinearLayout>

Related

Android - split view with button on top

I am trying to split screen in android and trying to overlay a button on top of divider
Below is the current and expected
Below is my XML layout file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF0000"
android:weightSum="2">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#ff0000" />
<RelativeLayout
android:background="#00ff00"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1">
<ImageButton
android:id="#+id/imageButton"
android:layout_width="90sp"
android:layout_height="90sp"
app:srcCompat="#drawable/exchange"
android:layout_centerHorizontal="true"
android:layout_marginTop="-45dp"/>
</RelativeLayout>
</LinearLayout>
You can achieve this by aligning the layout in an ordered way or also by using the Constraint Layout.
demo.xml
[![<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#android:color/holo_red_light">
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#android:color/holo_blue_dark">
</RelativeLayout>
</LinearLayout>
<ImageButton
android:id="#+id/imageButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
app:srcCompat="#android:drawable/btn_dialog" />
</RelativeLayout>][1]][1]
Probably the simplest way to take what you have and make it work would be to use a FrameLayout to wrap your existing layout:
<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">
<!-- your current LinearLayout goes here, except for the ImageButton -->
<ImageButton
android:id="#+id/imageButton"
android:layout_width="90sp"
android:layout_height="90sp"
android:layout_gravity="center"
app:srcCompat="#drawable/exchange"/>
</FrameLayout>
The android:layout_gravity attribute is the key here; that will float your button in the center of the screen.
While the above will work, I'd recommend using ConstraintLayout instead:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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="#FF0000"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/top"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#ff0000"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="#+id/bottom"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<RelativeLayout
android:id="#+id/bottom"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#00ff00"
app:layout_constraintTop_toBottomOf="#+id/top"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<ImageButton
android:id="#+id/imageButton"
android:layout_width="90sp"
android:layout_height="90sp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="#drawable/exchange"/>
</androidx.constraintlayout.widget.ConstraintLayout>
By doing it this way, you flatten everything into a single view group.
<RelativeLayout 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">
<LinearLayout
android:id="#+id/topView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</LinearLayout>
<ImageButton
android:id="#+id/imageButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
app:srcCompat="#android:drawable/btn_dialog" />
<LinearLayout
android:id="#+id/bottomView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</LinearLayout>
</RelativeLayout>

ListView in BottomSheet not scrolling

Writing for Android API 23 and above (testing on API 24 and 25).
I have written an XML which attempts to put a ListView inside of a BottomSheet. When I attempt to scroll my ListView (in any direction) the BottomSheet scrolls rather than the ListView.
I've tried the following workaround without any success:
ListView in BottomSheet
My XML layout file is as follows:
<?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"
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<RelativeLayout 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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="#+id/refresh_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onButtonPress"
android:text="#string/refresh_button" />
<RelativeLayout
android:id="#+id/map_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<fragment
android:id="#+id/map_fragment"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/floating_action_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="15dp"
android:layout_marginRight="15dp"
android:clickable="true"
app:srcCompat="#android:drawable/ic_menu_mylocation" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<android.support.v4.widget.NestedScrollView
android:id="#+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="?android:attr/windowBackground"
android:clipToPadding="true"
android:fillViewport="true"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:orientation="horizontal">
<TextView
android:id="#+id/textView11"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="16dp"
android:text="Stations"
android:textColor="#ffffff"
android:textSize="24sp" />
</LinearLayout>
<com.example.nicsutherland.stationfinder.Adapters.BottomSheetListView
android:id="#+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<FrameLayout
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.design.widget.CoordinatorLayout>
My java class contains the following code in the onCreate() method:
View bottomSheet = findViewById( R.id.bottom_sheet );
mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
mBottomSheetBehavior.setPeekHeight(300);
How can I get to a point where my ListView will scroll independently of my BottomSheet?
try this :
com.example.nicsutherland.stationfinder.Adapters.BottomSheetListView
android:id="#+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="true"\\insert this line
/>
Set the BottomSheetDialog Cancelable false and CanceledOnTouchOutside true
bottomSheetDialog.setCancelable(false);
bottomSheetDialog.setCancelable(false);
bottomSheetDialog.setCanceledOnTouchOutside(true);

Android Studio DrawerLayout scrimcolor not showing

I have an activity that uses the following layout:
<android.support.v4.widget.DrawerLayout
android:id="#+id/root_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:openDrawer="start"
xmlns:tools="http://schemas.android.com/tools">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbarlayout_main_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_main_activity"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>
<android.support.design.widget.TabLayout
android:id="#+id/tablayout_main_activity"
app:tabIndicatorHeight="3dp"
app:tabIndicatorColor="#android:color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v4.view.ViewPager
android:id="#+id/viewpager_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorWindowBackground"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigationview"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#color/colorWindowBackground"
android:fitsSystemWindows="true"
android:layout_gravity="start">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="#layout/drawer_header" />
<ExpandableListView
android:id="#+id/expandablelistview_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:groupIndicator="#null"
android:divider="#null"
android:dividerHeight="0dp"/>
</LinearLayout>
</ScrollView>
</android.support.design.widget.NavigationView>
I have tried all that I could think of, such as; putting the navigationView inside the appbarlayout in different places, putting it before the appbarlayout and after it and lastly trying to set the scrimcolor dynamically in the oncreate method of the activity. None of these things worked, does someone know the solution to my problem?
After a lot of trying I made it working. The reason why is not clear to me but here is the working layout for the people who have the same problem:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
android:id="#+id/root_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:openDrawer="start"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:id="#+id/linearlayout_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbarlayout_main_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_main_activity"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>
<android.support.design.widget.TabLayout
android:id="#+id/tablayout_main_activity"
app:tabIndicatorHeight="3dp"
app:tabIndicatorColor="#android:color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorWindowBackground"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigationview"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#color/colorWindowBackground"
android:fitsSystemWindows="true"
android:layout_gravity="start">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="#layout/drawer_header" />
<ExpandableListView
android:id="#+id/expandablelistview_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:groupIndicator="#null"
android:divider="#null"
android:dividerHeight="0dp"/>
</LinearLayout>
</ScrollView>
</android.support.design.widget.NavigationView>

Navigation drawer with bottom navigation

In my application i want a navigation drawer with bottom navigation menu, but problem is that my container(content page) is overlapping the bottom navigation bar , i have attached my layout code with this question, please can anyone tell me what is wrong with the code?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.tunky.cardmaterial.MainActivity">
<RelativeLayout
android:id="#+id/container_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:openDrawer="start">
<FrameLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:id="#+id/card_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="#+id/card_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</LinearLayout>
</FrameLayout>
<include
layout="#layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<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:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"
app:menu="#menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?android:attr/windowBackground"
app:menu="#menu/navigation" />
</RelativeLayout>
I have updated your layout xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:openDrawer="start">
<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:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"
app:menu="#menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
<RelativeLayout
android:id="#+id/container_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#id/navigation">
<include
android:id="#+id/app_bar_layout"
layout="#layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="#id/app_bar_layout"
android:layout_weight="1">
<LinearLayout
android:id="#+id/card_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="#+id/card_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</LinearLayout>
</FrameLayout>
</RelativeLayout>
<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="?android:attr/windowBackground"
app:menu="#menu/navigation" />
</RelativeLayout>

Gravity in LinearLayout - android?

I created bellow Layout :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/relativeStart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/back"
tools:context=".SongsActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/header"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#null"
android:src="#drawable/felesh_m" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal|center_vertical"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical">
<ImageButton
android:id="#+id/imbCenter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:background="#null"
android:src="#drawable/hosein_hlarge" />
</LinearLayout>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#null"
android:src="#drawable/felesh_m" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4" />
</LinearLayout>
</RelativeLayout>
See bellow Image :
Change your layout like this. You don't need to take multiple Linear Layouts. That is bad for performance. So I have changed it to single Linear Layout with some Weight properties.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/relativeStart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/common_ic_googleplayservices">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/common_ic_googleplayservices"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="horizontal">
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.50"
android:background="#null"
android:src="#drawable/common_ic_googleplayservices" />
<ImageButton
android:id="#+id/imbCenter"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:background="#null"
android:src="#drawable/common_ic_googleplayservices" />
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.50"
android:background="#null"
android:src="#drawable/common_ic_googleplayservices" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4" />
</LinearLayout>
</RelativeLayout>

Resources