I created few CardView for my project and notice it that my page is not scrollable, I've search and found some method like changing the RelativeLayout to ScrollView
but when i run my apps it crash it got an error on my mainActivity java. So I decided to change it back and put the ScrollView
on the top of my LinearLayout
it works but, my last CardView didn't fully show up some the part got hidden behind the bottom navigation. Can someone help me or enlighten me how should i implement the ScrollView
inside my xml file?
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"
tools:context=".MainActivity">
<com.google.android.material.bottomnavigation.BottomNavigationView ...>
<LinearLayout
android:id="@+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/btm_nav"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar...>
<technolifestyle.com.imageslider.FlipperLayout ...>
<androidx.cardview.widget.CardView ...>
<androidx.cardview.widget.CardView ...>
<androidx.cardview.widget.CardView ...>
</LinearLayout>
</RelativeLayout>
Put your RelativeLayout
inside a ScrollView. Furthermore, if your last cards are behind the bottomNavigation add android:clipToPadding="false"
attribute to ScrollView and add some bottom padding.