Floating Action Button is duplicated in fragment - android

In a project, there was a FloatingActionButton in one of the activities. I attempted to add a Fragment in that activity and move the FAB inside that Fragment. Everything seemed to be OK, however when I tried to display a SnackBar, I noticed there are two FloatingActionButtons instead of one in that area (One of them moving up with SnackBars).
In XML, there's only one FAB but when I run the app, two FABs appear which are on each other until a SnackBar is displayed. I'm trying to find the bug which caused the FAB to be duplicated.
Activity XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
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"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="#+id/fl_main_root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/cl_main_toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize">
<androidx.appcompat.widget.Toolbar
android:id="#+id/tb_main_toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="#color/colorPrimary"
android:minHeight="?android:attr/actionBarSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
local:popupTheme="#style/ThemeOverlay.AppCompat.Light"
local:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
<TextView
android:id="#+id/tv_main_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:textColor="#color/white"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<fragment
android:id="#+id/f_main_memory"
android:name="ir.ali_kh_y.project.fragment.MemoryFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?android:attr/actionBarSize"
android:layout_marginBottom="56dp"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bnv_main_nav"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="bottom"
android:background="#color/colorPrimary"
app:itemIconTint="#color/bottom_nav_item_color_state"
app:itemTextColor="#color/bottom_nav_item_color_state"
app:labelVisibilityMode="unlabeled"
app:menu="#menu/bottom_nav"/>
</FrameLayout>
Fragment XML:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.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/cl_memory_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragment.MemoryFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/cl_memory_memories"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_memory_memories"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#ECEFF1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="#+id/iv_memory_smile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/empty_list"/>
<TextView
android:id="#+id/tv_memory_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text="---"
android:textAlignment="center"
android:textColor="#color/emptyListContent"
android:textSize="30dp"
app:layout_constraintBottom_toTopOf="#+id/iv_memory_smile"
app:layout_constraintHorizontal_bias="0.504"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/fab_memory_write"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/fab_margin"
android:clickable="true"
android:focusable="true"
app:fabSize="normal"
app:layout_anchor="#+id/cl_memory_memories"
app:layout_anchorGravity="left|bottom"
app:rippleColor="#color/gray"
app:srcCompat="#drawable/ic_write"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
The code I use in Activity to show Snack Bar:
val snackBar = Snackbar.make(cl_memory_root, "", Snackbar.LENGTH_INDEFINITE)
ViewCompat.setLayoutDirection(snackBar.view, ViewCompat.LAYOUT_DIRECTION_RTL)
snackBar.setAction("") {
//...
}
snackBar.show()

<androidx.coordinatorlayout.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/cl_memory_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:clickable="true"
tools:context=".fragment.MemoryFragment">
make background as white and make it clickable in the fragment and voila..

As Mike M mentioned, I was trying to load one Fragment twice, once from the code and once from the XML layout! So I deleted the one in the code and the duplication problem disappeared!

Related

How to make SearchView always on top in NestedScrollView?

I need to fix the place of searchView to the top. Even if user scrolls searchView must stay on the top. My xml is like that:
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/colorOffWhite"
tools:context=".HomeFragment"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<SearchView
android:id="#+id/searchView"
android:background="#color/colorBorder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/horizontalCategoryRV"
android:layout_width="412dp"
android:layout_height="121dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/searchView" />
<TextView
android:id="#+id/textView"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="5dp"
android:gravity="center_vertical"
android:text="#string/recent_products"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/horizontalCategoryRV">
</TextView>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_dashboard_items"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView"
android:layout_marginBottom="70dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
How can I implement a solution for this? I tried it with toolbar but I don't know if it's right to do that in a fragment. (This is a fragment's layout and I'm on Kotlin)
you can try use property
android:iconifiedByDefault="false" on your XML

Why is my recyclerview showing a whitespace

I am practing recyclerView in a fragment in Android Studio, I made this Application;
As you can see there is a whitespace between the toolbar (appbar) and the contents (i.e the recyclerview in this case)
Please, how do I get rid of this whitespace..
Here's the .xml file of the fargment I put the recyclerview:
<androidx.constraintlayout.widget.ConstraintLayout 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=".ui.newscreen.NewScreenFragment">
<!-- TODO: Update blank fragment layout -->
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerview"
android:layout_width="0dp"
android:layout_height="0dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="#layout/new_screen_recyclerview_look" />
</androidx.constraintlayout.widget.ConstraintLayout>
Here's the sample layout listItem;
<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="wrap_content">
<androidx.cardview.widget.CardView
android:id="#+id/cardView"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginStart="8dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:cardCornerRadius="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="#+id/card_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
app:srcCompat="#drawable/nav_header_image_nature"
android:contentDescription="#string/images_for_the_stories" />
</androidx.cardview.widget.CardView>
<TextView
android:id="#+id/card_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="#string/Leonardo_Del_Vecchio"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="#+id/cardView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/cardView"
app:layout_constraintTop_toTopOf="#+id/cardView"
app:layout_constraintVertical_bias="0.04000002" />
<TextView
android:id="#+id/card_tontent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:maxLines="3"
android:text="#string/sample_story_content"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/cardView"
app:layout_constraintTop_toBottomOf="#+id/card_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
Thanks in Advance for your Help!
I have been able to solve the issue.
There was a attribute in the main_activity.xml that cause this.
which was android:paddingTop="?attr/actionBarSize
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="?attr/actionBarSize">

how to hide bottomnavigation and app bar on scroll when app bar inside FragmentContainerView

I know we can hide bottomnavigation and app bar on scroll when both are the direct children of coordinate layout, But my issue is different, I have one home fragment and bottom view is a part of this fragment with FragmentContainerView, now my app bar inside the fragment which i am setting in container view, when i am scrolling, app bar getting scroll properly but i am not sure how to scroll bottom navigation as well,
home_fragment:
<?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">
<androidx.fragment.app.FragmentContainerView
android:id="#+id/rootFragmentContainer"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#+id/bottomNavigationView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemIconTint="#drawable/nav_bar_tab_color"
android:background="?android:attr/windowBackground"
app:itemTextAppearanceActive="#style/navText"
app:itemTextAppearanceInactive="#style/navText"
app:itemTextColor="#drawable/nav_bar_tab_color"
app:labelVisibilityMode="unlabeled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="#menu/navigation_items" />
</androidx.constraintlayout.widget.ConstraintLayout>
another fragment:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
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:fitsSystemWindows="true">
<ProgressBar
android:id="#+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/layout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="#id/appbar"
app:layout_behavior="#string/appbar_scrolling_view_behavior" >
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rvLay"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#+id/rvProgressBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ProgressBar
android:id="#+id/rvProgressBar"
android:visibility="gone"
android:layout_width="0dp"
android:layout_height="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="#color/colorWhite"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="#style/ThemeOverlay.AppCompat" >
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="#dimen/twentyfour_24dp"
android:paddingBottom="#dimen/eighteen_18dp"
android:text="#string/t2"
android:gravity="center"
android:textAllCaps="true"
style="#style/text_16px_franklin_gothic_normal_" />
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Can some one please explain me, how to achieve it?
Have you tried to add app:layout_behavior="#string/hide_bottom_view_on_scroll_behavior" inside your BottomNavigationView? In my case, it works just fine :)
I also suggest you to use CoordinatorLayout instead of ConstraintLayout in your home_fragment.xml

Fragment is not fully displayed when used in activity with actionbar

In my activity (ConstraintLayout) I have an actionbar and a container (for my viewpage adapater). In this container I am displaying various fragments.
My problem is that the fragments (also in ConstraintLayout) are not completely displayed, meaning they are cut off at the end. My assumption is that this happens because the fragment "doesnt know" about the action bar in the activity and thus thinks it has the full screen to use but instead this part which the action bar takes up is moved down and off from the screen. That's just an assumption maybe I am completely wrong. Anybody can help on how to make sure the fragment layout is somehow "fitted" right to the screen?
my activity xml with the actionbar:
<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:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".TourActivity">
<include
android:id="#+id/app_bar"
layout="#layout/app_bar"
tools:layout_editor_absoluteY="8dp"></include>
<android.support.v4.view.ViewPager
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/app_bar" />
</android.support.constraint.ConstraintLayout>
the fragment 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TourActivity">
<TextView
android:id="#+id/test"
android:layout_width="388dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:gravity="center"
android:text="testtest testtest"
android:textSize="25dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.52"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/imageView"
android:layout_width="365dp"
android:layout_height="185dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/question"
tools:src="#android:color/darker_gray" />
<Button
android:id="#+id/answerButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="156dp"
android:layout_marginEnd="8dp"
android:text="answerButton1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView" />
<Button
android:id="#+id/answerButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="8dp"
android:text="answerButton2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/answerButton1" />
<Button
android:id="#+id/answerButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="8dp"
android:text="answerButton3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/answerButton2" />
</android.support.constraint.ConstraintLayout>
<android.support.v4.view.ViewPager
android:id="#+id/container"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/app_bar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
Pls give that a go.
Use Relative Layout in the main 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="wrap_content"
tools:context=".TourActivity">
<include
android:id="#+id/app_bar"
layout="#layout/app_bar"
tools:layout_editor_absoluteY="8dp"/>
<android.support.v4.view.ViewPager
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/app_bar" />
</RelativeLayout>

RecyclerView in FrameLayout overlapping other elements

In my android app, I am having following framelayout
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context=".fragments.AppointmentFragment">
<!-- TODO: Update blank fragment layout -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:orientation="vertical">
<com.github.jhonnyx2012.horizontalpicker.HorizontalPicker
android:id="#+id/datePicker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/datePicker" />
</RelativeLayout>
</FrameLayout>
My HorizontalPicker is rendered correctly, however, recycler_view (RecycleView) content is being overlapped in HorizontalPicker.
I have tried various suggestions offered in Stakeoverflow, however nothing works.
Can somebody help me reolving the issue. I have also tried setting the android:layout_height="0dp" as suggested in other such issue, however it stops displaying the content of Recyclerview.
Just try with the following. It may work.
<android.support.v7.widget.RecyclerView
android:layout_below="#+id/datePicker"
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/datePicker" />

Categories

Resources