I have a problem when opening DrawerLayout while having BottomSheetBehavior at the bottom of the layout. BottomSheetBehavior layout is hidden at the moment, but the DrawerLayout is cropped at a place where is BottomSheetBehavior layout top height.
Any ideas?
DrawerLayout with BottomSheetBehavior
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.some.example.widgets.SearchBarWidget
android:id="#+id/searchBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginEnd="15dp"
android:layout_marginStart="15dp"
android:layout_marginTop="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.some.example.MapView
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="#+id/map"
app:layout_constraintEnd_toEndOf="#+id/map"
app:layout_constraintStart_toStartOf="#+id/map"
app:layout_constraintTop_toTopOf="#+id/map" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include layout="#layout/layout_bottom_sheet" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.navigation.NavigationView
android:id="#+id/navigationView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="#layout/navigation_header"
app:menu="#menu/navigation_menu" />
</androidx.drawerlayout.widget.DrawerLayout>
layout_bottom_sheet.xml
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/bottomSheetLayout"
android:layout_width="match_parent"
android:layout_height="240dp"
android:background="#drawable/bottom_sheet_background"
android:orientation="vertical"
android:paddingTop="0dp"
app:behavior_hideable="true"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<LinearLayout
android:id="#+id/gestureLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingTop="10dp">
<ImageView
android:id="#+id/expandCollapseImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="#drawable/expand"
tools:ignore="ContentDescription" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
I rearranged layout like that, I put ConstraintLayout outside CoordinatorLayout and it worked.
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.some.example.widgets.SearchBarWidget
android:id="#+id/searchBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginEnd="15dp"
android:layout_marginStart="15dp"
android:layout_marginTop="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.some.example.MapView
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="#+id/map"
app:layout_constraintEnd_toEndOf="#+id/map"
app:layout_constraintStart_toStartOf="#+id/map"
app:layout_constraintTop_toTopOf="#+id/map" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000">
<include layout="#layout/layout_bottom_sheet" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.navigation.NavigationView
android:id="#+id/navigationView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="#layout/navigation_header"
app:menu="#menu/navigation_menu" />
</androidx.drawerlayout.widget.DrawerLayout>
Related
I am using BottomNavigationView and AppBarLayout.
But the content at the bottom of the AppBarLayout is cut off as in the picture.
How do I make everything visible? (I can't move the graph upwards because there is something to add at the top of the graph.)
Below is the XML code of the screen in the picture: (Fragment)
<androidx.core.widget.NestedScrollView
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="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.github.mikephil.charting.charts.LineChart
android:id="#+id/lineChart"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_marginTop="24dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp">
</com.github.mikephil.charting.charts.LineChart>
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="보이니?"
android:textSize="23sp"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
Below is the AppbarLayout XML code that the fragment contains.
<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">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<com.google.android.material.tabs.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/background_light"
android:elevation="1dp"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabMaxWidth="0dp"
app:tabSelectedTextColor="#color/design_default_color_primary_dark"
app:tabTextColor="#color/design_default_color_primary" />
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"></FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Below is the BottomNavigationView XML code.
<androidx.constraintlayout.widget.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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeDefault">
<FrameLayout
android:id="#+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#+id/navigationView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"></FrameLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/navigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:background="?android:attr/windowBackground"
app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/frameLayout"
app:itemIconTint="#drawable/bottom_navigation_color"
app:itemTextColor="#drawable/bottom_navigation_color"
app:menu="#menu/menubar" />
</androidx.constraintlayout.widget.ConstraintLayout>
I have the following activity where I have an imageview , 2 flipper views and a gridview along with a navigation drawer.As gridView is a scroll enabled activity by default ,earlier only my gridview was scrollable. I wanted my whole activity to be scrollable instead of just the gridView , so for that I put my frameLayout inside a nestedScrollView.
I also set grid.setNestedScrollingEnabled(false) in my MainActivity.java .
Here's my xml file:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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"
android:id="#+id/drawerLayout"
android:nestedScrollingEnabled="true"
tools:context="com.example.xxx.xxx.MainActivity"
app:layout_behavior="android.support.design.widget.AppBarLayout.ScrollingViewBehaviour">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/frameLayout">
<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/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffff"
android:fitsSystemWindows="true"
android:isScrollContainer="true"
android:orientation="vertical"
tools:context="com.example.xxx.xxx.MainActivity">
<ImageView
android:id="#+id/b1"
android:layout_width="wrap_content"
android:layout_height="61dp"
android:scaleType="fitXY"
android:src="#drawable/banner1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:contentDescription="#string/todo" />
<technolifestyle.com.imageslider.FlipperLayout
android:id="#+id/flipper"
android:layout_width="wrap_content"
android:layout_height="66dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/b1" />
<technolifestyle.com.imageslider.FlipperLayout
android:id="#+id/Flipper2"
android:layout_width="wrap_content"
android:layout_height="67dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/flipper">
</technolifestyle.com.imageslider.FlipperLayout>
<GridView
android:id="#+id/grid"
android:layout_width="wrap_content"
android:layout_height="542dp"
android:background="#ffff"
android:gravity="center"
android:horizontalSpacing="2dp"
android:numColumns="3"
android:padding="2dp"
android:stretchMode="columnWidth"
android:verticalSpacing="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Flipper2"
app:layout_constraintVertical_bias="0.615" />
</android.support.constraint.ConstraintLayout>
</FrameLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.NavigationView
android:id="#+id/navView"
android:layout_width="200dp"
android:layout_height="match_parent"
app:menu="#menu/navigation_menu"
android:background="#ffff"
app:itemTextColor="#0f0f0f"
android:layout_gravity="start"
app:itemIconTint="#color/black_overlay"
android:fitsSystemWindows="true"/>
</android.support.v4.widget.DrawerLayout>
I have a problem with fragment when I added contents do not to all page just stay at the top, I want to fit all layout and I use BottomNavigationView to bottom application use fragment to show contents.
enter image description here
<FrameLayout 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"
app:layout_behavior="appbar_scrolling_view_behavior"
tools:context="com.example.hp.votingsystemv1.Fragments.HelpFragment">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/help"/>
</FrameLayout>
<?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:id="#+id/main_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hp.votingsystemv1.Activities.MainActivity">
<FrameLayout
android:id="#+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<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="#color/colorPrimary"
app:menu="#menu/bottombar_menu"
app:itemTextColor="#color/colorWhite"
app:itemIconTint="#color/colorWhite">
</android.support.design.widget.BottomNavigationView>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
Use this
<FrameLayout 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"
app:layout_behavior="appbar_scrolling_view_behavior">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/ic_action_rupee" />
<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:id="#+id/main_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hp.votingsystemv1.Activities.MainActivity">
<FrameLayout
android:id="#+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<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="#color/colorPrimary"
>
</android.support.design.widget.BottomNavigationView>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
</FrameLayout>
I've implemented BottomNavigationView (BNV). My BNV always stay on top of other view, how can I make it stay under other view?
This is my View
<RelativeLayout xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.BottomNavigationView
android:id="#+id/bottomNavi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/color_bottom_navi"
app:itemBackground="#drawable/selector_navi_bottom"
app:itemIconTint="#color/colorPrimary"
app:itemTextColor="#color/colorPrimary"
app:menu="#menu/bottom_navigation" />
<FrameLayout
android:id="#+id/frm_content_full"
android:layout_width="match_parent"
android:background="#color/colorPrimaryDark"
android:layout_height="match_parent" />
</RelativeLayout>
This is what it shown.
Thanks.
EDIT 1: The space below BNV is for AdView, my question is about when I use above code, screen will become Blue, BNV will be hidden.
Try this xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="#+id/frm_content_full"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/linear_bottombar"
android:background="#color/colorPrimaryDark" />
<LinearLayout
android:id="#+id/linear_bottombar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<android.support.design.widget.BottomNavigationView
android:id="#+id/bottomNavi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/color_bottom_navi"
app:itemBackground="#drawable/selector_navi_bottom"
app:itemIconTint="#color/colorPrimary"
app:itemTextColor="#color/colorPrimary"
app:menu="#menu/bottom_navigation" />
<!--your adview-->
</LinearLayout>
</RelativeLayout>
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context="com.study.navcon.module.home.HomeScreenActivity">
<RelativeLayout
android:id="#+id/activity_main"
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:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:titleTextColor="#android:color/white"/>
<FrameLayout
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="50dp"
android:layout_above="#+id/navigation"
android:animateLayoutChanges="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="?android:attr/windowBackground"
app:menu="#menu/navigation"/>
</RelativeLayout>
</LinearLayout>
try this
<?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">
<FrameLayout
android:id="#+id/frm_content_full"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimaryDark" />
<android.support.design.widget.BottomNavigationView
android:id="#+id/bottomNavi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:itemBackground="#android:color/holo_red_light"
app:itemIconTint="#android:color/white"
app:itemTextColor="#android:color/white"
app:menu="#menu/bottom_navigation_main" />
</RelativeLayout>
[1]: https://i.stack.imgur.com/iyDlC.jpg
In my android app I have a recyclerview inside my main activity.
These recyclerview is supposed to display documents to the user.
My problem is that the items overlap the right part of the screen. I don't know why it happens. I have worked with CardViews before but I can't seem to solve this.
Here is a screenshot of my problem:
As you can see, the right side of the CardViews overlaps the screen.
Here is the main activity layout code:
<?xml version="1.0" encoding="utf-8"?>
<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/top_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorBackground"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<include layout="#layout/toolbar"
android:id="#+id/toolbar_layout"
tools:layout_constraintTop_creator="1"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="384dp"
android:layout_height="567dp"
android:fitsSystemWindows="true"
tools:layout_constraintTop_creator="1"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.silverfix.dgdeditor.utils.views.EmptyViewRecyclerView
android:id="#+id/documents_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:focusable="true"
android:scrollbars="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:listitem="#layout/document_list_item" />
<ImageView
android:id="#+id/empty_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/empty_view"
android:scaleX="0.5"
android:scaleY="0.5" />
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginTop="?attr/actionBarSize"
android:background="#drawable/menu_background"
android:fitsSystemWindows="true"
android:padding="10dp"
app:menu="#menu/nav_drawer_menu"
app:headerLayout="#layout/nav_header"
app:itemTextAppearance="#style/NavDrawerTextStyle" />
</android.support.v4.widget.DrawerLayout>
</android.support.constraint.ConstraintLayout>
And here is the document_list_item code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/dg_card_view"
android:layout_width="match_parent"
android:layout_height="#dimen/dg_card_view_height"
android:clickable="true"
android:focusable="true"
android:foreground="?android:selectableItemBackground"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="3dp"
card_view:cardUseCompatPadding="true"
card_view:cardPreventCornerOverlap="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_alignParentBottom="true"
android:background="#drawable/nav_item_divider" />
<TextView
android:id="#+id/document_card_name_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="#dimen/card_side_padding"
android:text="Document: "
android:textAppearance="#style/TextAppearance.AppCompat" />
<TextView
android:id="#+id/document_card_date_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/document_card_name_tv"
android:layout_marginRight="#dimen/card_side_padding"
android:text="Date"
android:textAppearance="#style/TextAppearance.AppCompat" />
</RelativeLayout>
</android.support.v7.widget.CardView>