ScrollView can host only one direct child and i also have only one child - android

I have a layout which need to be scrollable.This is a fragment and the fragment hosted on a activity.The ScrollView has only one child which is relativeLayout and the relativeLayout has multiple child.But i still get the error.The error occured when i install and open the screen,after 5 or 6 second,the app is crashed.
This is my layout structure for fragment:
<?xml version="1.0" encoding="utf-8"?>
<layout 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">
<data>
</data>
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable"/>
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/settingsAppBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
/>
<com.google.android.material.button.MaterialButton
android:id="#+id/backButton"
style="#style/back_arrow_button"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.cardview.widget.CardView
>
<LinearLayout
>
<RelativeLayout style="#style/settings_relative_layout_style">
<TextView
/>
<com.google.android.material.imageview.ShapeableImageView
/>
</RelativeLayout>
<View
android:layout_width="match_parent"
/>
<TextView
style="#style/settings_text_style"
/>
<RelativeLayout style="#style/settings_relative_layout_style">
<TextView
/>
<ImageView
/>
</RelativeLayout>
<RelativeLayout style="#style/settings_relative_layout_style">
<TextView
/>
<ImageView
/>
</RelativeLayout>
<View
android:layout_height="1dp"
/>
<TextView
/>
<RelativeLayout style="#style/settings_relative_layout_style">
<TextView
/>
<ImageView
/>
</RelativeLayout>
<RelativeLayout style="#style/settings_relative_layout_style">
<TextView
/>
<ImageView
/>
</RelativeLayout>
<RelativeLayout style="#style/settings_relative_layout_style">
<TextView
/>
<ImageView
/>
</RelativeLayout>
<RelativeLayout style="#style/settings_relative_layout_style">
<TextView
/>
<ImageView
style="#style/settings_image_view_style"
/>
</RelativeLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
</ScrollView>
</layout>
This is the layout for Main activity:
<?xml version="1.0" encoding="utf-8"?>
<layout 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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.presentations.activity.MainActivity">
<androidx.fragment.app.FragmentContainerView
android:id="#+id/fragmentContainerView"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/bottomMenu"
app:defaultNavHost="true" />
<me.ibrahimsn.lib.SmoothBottomBar
android:visibility="gone"
app:iconSize="#dimen/l"
android:elevation="#dimen/xxxs"
app:iconTintActive="#color/nav_icon_color"
app:iconTint="#D0D0D0"
android:id="#+id/bottomMenu"
android:layout_width="match_parent"
android:layout_height="#dimen/xxxxxxl"
android:layout_alignParentBottom="true"
app:menu="#menu/bottom_nav_menu" />
</RelativeLayout>
</layout>
The error msg:
FATAL EXCEPTION: main Process: ltd.tinkers.example, PID: 10147 java.lang.IllegalStateException: ScrollView can host only one direct child at androidx.core.widget.NestedScrollView.addView(NestedScrollView.java:515) at com.google.android.material.snackbar.BaseTransientBottomBar$SnackbarBaseLayout.addToTargetParent(BaseTransientBottomBar.java:1330) at com.google.android.material.snackbar.BaseTransientBottomBar.showView(BaseTransientBottomBar.java:757) at com.google.android.material.snackbar.BaseTransientBottomBar$1.handleMessage(BaseTransientBottomBar.java:263) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7948) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:603) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I try to use NestedScrollView but problem not fix.I wrap the fragment layout scroll view with FrameLayout which is found from stack overflow answer.But this did not work.

Related

Big text are being cut at bottom portion of tabbed activity in android

I am using android tabbed activity but, last few lines of big text are being cut at bottom portion of tabbed activity in android.
This is the "activity_main.xml" file:-
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/Theme.BhagavadGitaUI.AppBarOverlay">
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:minHeight="?actionBarSize"
android:padding="#dimen/appbar_padding"
android:text="#string/app_name"
android:textAppearance="#style/TextAppearance.Widget.AppCompat.Toolbar.Title" />
<com.google.android.material.tabs.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:tabMode="scrollable" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="#+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<!--<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="#dimen/fab_margin"
android:layout_marginBottom="16dp"
app:srcCompat="#android:drawable/ic_dialog_email" />-->
</androidx.coordinatorlayout.widget.CoordinatorLayout>
This is the "fragment_main.xml" file:-
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.PlaceholderFragment">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
<TextView
android:id="#+id/section_label"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="0dp"
android:layout_marginBottom="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="#+id/constraintLayout"
tools:layout_constraintLeft_creator="0"
tools:layout_constraintTop_creator="0" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
I am putting text/string directly in the java file and last 1 line is not visible.
Please let me know where the issue is and oblige me thereby.
Thanks.

Fragment layout is not Scrolling completely when keyboard opens

I want the layout inside my fragment to scroll completely and place it above the softkeyboard whenever keyboard opens. But the problem is the layout is not even scrolling when i user click on keyboard. It covers up some part of the layout.
I have tried many SO threads already but none of them seems to be working.
Here's the activity layout:
<?xml version="1.0" encoding="utf-8"?>
<layout 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">
<data>
<import type="android.view.View" />
<variable
name="viewModel"
type="com.abc.viewModel" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".home.HomeActivity">
<com.google.android.material.card.MaterialCardView
android:id="#+id/taskBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_minus10sdp"
android:background="#android:color/white"
app:cardCornerRadius="#dimen/_5sdp">
</com.google.android.material.card.MaterialCardView>
<LinearLayout
android:id="#+id/appbar_practice"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimaryDark"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="#dimen/_10sdp">
</LinearLayout>
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</layout>
Here's the fragment layout:
<?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:layout_width="match_parent"
android:layout_height="wrap_content"
android:isScrollContainer="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:animateLayoutChanges="true"
android:background="#drawable/ic_bg_splash"
android:fillViewport="true"
android:paddingBottom="#dimen/_10sdp">
<LinearLayout
android:id="#+id/cardview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<ImageButton
android:id="#+id/previous"
android:layout_width="#dimen/_30sdp"
android:layout_height="#dimen/_30sdp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="#dimen/_20sdp"
android:background="#drawable/left"
android:padding="#dimen/_5sdp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<ImageButton
android:id="#+id/next"
android:layout_width="#dimen/_30sdp"
android:layout_height="#dimen/_30sdp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="#dimen/_20sdp"
android:background="#drawable/right" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
Manifest:
<activity android:name=".home.MainActivity"
android:screenOrientation="landscape"
android:theme="#style/MaterialThemeHome"></activity>

I am working with Android Data Binding from activity to layout as a string but its not showing

I am sending the string from my activity to the layout that is created as a common layout with data binding but it's not working. I have checked a lot of answers but nothing is working for me.
I want the same thing as the OP wants in following question, but the solution he accepted is not working for me.
Passing string to included layout via data binding not working
following is my layout resume_detail_heading.xml
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="sectionTitle"
type="java.lang.String" />
</data>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:cardBackgroundColor="#color/app_color_1">
<TextView
android:id="#+id/resume_detail_section_heading"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginVertical="10dp"
android:text="#{sectionTitle}"
android:textAlignment="center"
android:textColor="#color/color_white"
android:textSize="20sp" />
</android.support.v7.widget.CardView>
</layout>
And This is my Activity where I am calling the layout
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/color_white"
>
<data>
<variable
name="sectionTitle"
type="java.lang.String" />
</data>
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="#+id/availablitycardview"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="5dp"
android:background="#color/color_white">
<TextView
android:id="#+id/availablity"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Available Now"
android:gravity="center"
android:textColor="#color/color_white"
android:textSize="20sp" />
</android.support.v7.widget.CardView>
<include
android:id="#+id/titleRole"
layout="#layout/resume_detail_heading"
app:sectionTitle="#{#string/app_name}" />
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<ListView
android:id="#+id/roles_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:scrollbars="none"></ListView>
</android.support.v7.widget.CardView>
<!--For Skill-->
<include
android:id="#+id/titleSkill"
layout="#layout/resume_detail_heading"
app:sectionTitle="#{`Skill`}" />
...............

Android Bottom Sheet Is not Reacting To Touches and doesn't Scroll

so I have a problem: I added a LinearLayout with layout_behaviour as BottomSheetBehavior to a FrameLayout view I created and added above one my Activities, but my bottom sheet is not scrollable, I can only change its state programatically but touches don't react. What do you think can be the problem?
This is my xml:
<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/rich_media_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
. . . . . .
<LinearLayout
android:id="#+id/cue_point_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="16dp"
android:paddingBottom="16dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="#+id/cue_points_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="8dp" />
. . . . . .
</LinearLayout>
Use CoordinatorLayout as parent layout.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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">
<include layout="#layout/bottom_sheet" />
</android.support.design.widget.CoordinatorLayout>
bottom_sheet -
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="#+id/bottom_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:behavior_hideable="false"
app:behavior_peekHeight="204dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
.......
</LinearLayout>
you have to use CoordinatorLayout as root layout
activity_main--
<?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:background="#f7f7f7">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="attr/actionBarSize"
android:background="attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_main" />
<!-- Adding bottom sheet after main content -->
<include layout="#layout/bottom_sheet" />
</android.support.design.widget.CoordinatorLayout>
bottom_sheet--
<?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:id="#+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical"
android:padding="#dimen/activity_margin"
app:behavior_hideable="true"
app:behavior_peekHeight="56dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_vertical"
android:weightSum="3">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/activity_margin"
android:layout_weight="2"
android:text="Order Details"
android:textSize="18dp"
android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:gravity="right"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textStyle="bold"
android:textSize="15dp"
android:text="₹475.00"></TextView>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chicken Fried Rice 1x1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chiken Tikka 1x2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/activity_margin"
android:text="Delivery Address"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rohini delhi-42" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="#000"
android:foreground="?attr/selectableItemBackground"
android:text="PROCEED PAYMENT"
android:textColor="#fff" />
</LinearLayout>

Issue with recycler view inside constraint layout

I'm trying to create a bottom sheet dialog based on a complex layout.
What I have to achieve is a dialog with an header layout, a recycler view with a list of element and a bottom bar with a couple of buttons.
Here is my code:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Layout injected inside this linear layout container programmatically -->
<LinearLayout
android:id="#+id/header_dialog_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#id/form_dialog_recycler_view"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v7.widget.RecyclerView
android:id="#+id/form_dialog_recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scrollbars="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
app:layout_constraintBottom_toTopOf="#id/bottom_sheet_container_buttons"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/header_dialog_container" />
<LinearLayout
android:id="#+id/bottom_sheet_container_buttons"
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">
<Button
android:id="#+id/dialog_sheet_button_reset"
style="#style/ActionSheetTitle"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="0.5"
android:background="#color/bottomBarContainerColor"
android:text="#string/general_reset"
android:textColor="#color/dangerColor" />
<Button
android:id="#+id/dialog_sheet_button_close"
style="#style/ActionSheetTitle"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="0.5"
android:background="#color/bottomBarContainerColor"
android:text="#string/general_close" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</layout>
Unfortunately my recycler view height is always equal to zero. I tried to change android:layout_height="0dp" to android:layout_height="wrap_content" but as expected it goes below the bottom container. Am I missing something?
Try app:layout_constraintHeight_default="wrap" for RecyclerView if it's inside ConstraintLayout.
I ended up with a different solution. I changed constraint layout with a Linear Layout. And I set up bottom margins.
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/header_dialog_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<android.support.v7.widget.RecyclerView
android:id="#+id/form_dialog_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="60dp"
android:scrollbars="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<LinearLayout
android:id="#+id/bottom_sheet_container_buttons"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="-60dp"
android:orientation="horizontal">
<Button
android:id="#+id/dialog_sheet_button_reset"
style="#style/ActionSheetTitle"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="0.5"
android:background="#color/bottomBarContainerColor"
android:text="#string/general_reset"
android:textColor="#color/dangerColor" />
<Button
android:id="#+id/dialog_sheet_button_close"
style="#style/ActionSheetTitle"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="0.5"
android:background="#color/bottomBarContainerColor"
android:text="#string/general_close" />
</LinearLayout>
</LinearLayout>
</layout>
Try this code:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Layout injected inside this linear layout container programmatically -->
<LinearLayout
android:id="#+id/header_dialog_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#id/form_dialog_recycler_view"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v7.widget.RecyclerView
android:id="#+id/form_dialog_recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:scrollbars="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
app:layout_constraintBottom_toTopOf="#id/bottom_sheet_container_buttons"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/header_dialog_container" />
<LinearLayout
android:id="#+id/bottom_sheet_container_buttons"
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">
<Button
android:id="#+id/dialog_sheet_button_reset"
style="#style/ActionSheetTitle"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="0.5"
android:background="#color/bottomBarContainerColor"
android:text="#string/general_reset"
android:textColor="#color/dangerColor" />
<Button
android:id="#+id/dialog_sheet_button_close"
style="#style/ActionSheetTitle"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="0.5"
android:background="#color/bottomBarContainerColor"
android:text="#string/general_close" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</layout>
Use app:layout_constrainedHeight="true" in your RecyclerView. It will adjust inside constraints and won't go below the bottom container.

Categories

Resources