Reputation:
https://i.sstatic.net/Ymbrj.gif
How to stop Android Bottom navigation bar overlapping recyclerview ? i need to solve problem but i have no idea. I've tried a lot of ways. In the end, I can not reach. I need your help. I read the current topics. I think my problem is more comprehensive. The Recyler prints cardviews on the screen.
<?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"
xmlns:design="http://schemas.android.com/apk/res-auto"
tools:context="com.example.hasan.simpleblog.MainActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#ffffff"
>
<android.support.design.widget.BottomNavigationView
android:id="@+id/NavBot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:background="#ffff"
design:menu="@menu/menu_nav"
>
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="@color/colorPrimary" />
</android.support.design.widget.BottomNavigationView>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottom_navigation"
android:layout_alignParentTop="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior" >
</android.support.v4.view.ViewPager>
<android.support.v7.widget.RecyclerView
android:id="@+id/blog_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="?attr/actionBarSize"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp">
</android.support.v7.widget.RecyclerView>
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
Upvotes: 4
Views: 6195
Reputation: 1491
Use ConstraintLayout. Align the bottom edge of top view to the top edge of bottom view.
Example
xml
<android.support.constraint.ConstraintLayout 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=".MainActivity">
<ListView
android:id="@+id/list_item"
android:layout_width="0dp"
android:layout_height="0dp"
android:divider="@color/black"
android:dividerHeight="2dp"
app:layout_constraintBottom_toTopOf="@+id/navigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:layout_constraintHorizontal_bias="1.0"></ListView>
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation" />
</android.support.constraint.ConstraintLayout>
Design
Upvotes: 4
Reputation: 527
If you use CoordinatorLayout (like above). You can customize your view behavior to do exact same thing.
Here are some greate posts:
Upvotes: 0