This is the what my activity currently looks like.
I am able to elevate the first two CardView but for the bottom one it is not elevated. I have tried both app:cardElevation and android:elevation but none of the elevates the last card. (by the way what's the difference of these two?)
How can I elevate it?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="#+id/ef_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/colorBackgroundFloating"
android:elevation="2dp"
app:contentInsetStart="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageButton
android:id="#+id/cancel_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:background="#android:color/transparent"
android:src="#drawable/ic_cancel"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="#+id/confirm_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:background="#android:color/transparent"
android:src="#drawable/ic_confirm"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.Toolbar>
<android.support.v7.widget.CardView
android:id="#+id/food_image_card"
android:layout_width="180dp"
android:layout_height="180dp"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
app:cardElevation="2dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/ef_toolbar">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/food_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/food_image_place_holder" />
<ImageButton
android:id="#+id/camera_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="#drawable/ic_camera" />
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/food_name_card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
app:cardElevation="2dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/food_image_card">
<EditText
android:id="#+id/edit_food_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:ems="10"
android:hint="Food Name"
android:background="#null"
android:maxLength="50"
android:maxLines="1"
android:inputType="textPersonName"
android:importantForAutofill="no" />
</android.support.v7.widget.CardView>
<TextView
android:id="#+id/tags_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:text="Tags"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/food_name_card_view" />
<ImageButton
android:id="#+id/add_tag_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="#android:color/transparent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/tags_text"
app:srcCompat="#drawable/ic_add_dark" />
<android.support.v7.widget.CardView
android:id="#+id/tag_card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:minHeight="120dp"
app:cardElevation="2dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tags_text">
<FrameLayout
android:id="#+id/tags_frame"
android:layout_margin="4dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.v7.widget.CardView>
<TextView
android:id="#+id/food_note"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:text="Note"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tag_card_view" />
<android.support.v7.widget.CardView
android:id="#+id/food_note_card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:cardElevation="2dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/food_note">
<EditText
android:id="#+id/edit_note"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:ems="10"
android:textSize="16sp"
android:background="#null"
android:minHeight="200dp"
android:gravity="start|top"
android:inputType="textMultiLine"
android:singleLine="false" />
</android.support.v7.widget.CardView>
</android.support.constraint.ConstraintLayout>
</ScrollView>
add
Margin bottom = 10dp to this cardview
android:id="#+id/food_note_card_view"
This can be helpful
app:cardUseCompatPadding="true"
See the Below example
<androidx.cardview.widget.CardView
app:cardBackgroundColor="#FF0000"
app:cardElevation="2dp"
app:cardUseCompatPadding="true"
android:layout_width="match_parent"
android:layout_height="200dp"/>
Cardview not working properly inside Cardview.
Please try to place your cardview into another layout such as FrameLayout or RelativeLayout.
Related
I am making a register screen, that has a toolbar on top of it. When I scroll down the toolbar hides(goes up). I don't want my toolbar to scroll when I am scrolling. I don't want to use adjust resize or adjust pan because then the other parts then don't work correctly. I tried with appbar but it doesn't work. PS I hided some of my edit texts in body. Here is my design code
<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">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/register_background"
android:clipChildren="false"
android:clipToPadding="false"
android:fitsSystemWindows="true"
tools:context=".architecture.fragments.login.SignupFragment">
<androidx.appcompat.widget.Toolbar
android:id="#+id/flutra"
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">
<ImageButton
android:id="#+id/back_button_signup"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="15dp"
android:background="#drawable/grey_ellipse_back_button_shape"
android:src="#drawable/ic_backbutton_with_arrow" />
</androidx.appcompat.widget.Toolbar>
<androidx.constraintlayout.widget.Guideline
android:id="#+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.3" />
<androidx.core.widget.NestedScrollView
android:layout_width="0dp"
android:layout_height="0dp"
android:clickable="true"
android:fillViewport="true"
android:fitsSystemWindows="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:overScrollMode="never"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/guideline2">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false">
<eightbitlab.com.blurview.BlurView
android:id="#+id/blurView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="-1dp"
android:layout_marginTop="47dp"
android:layout_marginEnd="-1dp"
android:layout_marginBottom="-20dp"
android:background="#drawable/background_with_radius"
android:paddingBottom="40dp"
app:blurOverlayColor="#color/overlay_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/blur_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="#+id/signup_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="56dp"
android:fontFamily="#font/inter"
android:text="#string/sign_up"
android:textColor="#color/white"
android:textSize="21sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/blur_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/signup_tv">
<EditText
android:id="#+id/first_name_et"
style="#style/EditText"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginStart="16dp"
android:layout_marginTop="18dp"
android:layout_marginEnd="16dp"
android:background="#drawable/edittext_radius"
android:hint="#string/first_name"
android:maxLines="1"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:singleLine="true"
android:textColor="#color/white"
android:textColorHint="#color/text_light_color" />
<EditText
android:id="#+id/enter_email_et"
style="#style/EditText"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="#drawable/edittext_radius"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:singleLine="true"
android:textColor="#color/white"
android:textColorHint="#color/text_light_color" />
<EditText
android:id="#+id/password_edit_text"
style="#style/EditText"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="#drawable/edittext_radius"
android:hint="#string/password"
android:inputType="textPassword"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:textColor="#color/white"
android:textColorHint="#color/text_light_color" />
<com.google.android.material.button.MaterialButton
android:id="#+id/register_button"
style="#style/AccentButton"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="16dp"
android:insetLeft="0dp"
android:insetTop="0dp"
android:insetRight="0dp"
android:insetBottom="0dp"
android:text="#string/sign_up" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</eightbitlab.com.blurview.BlurView>
<ImageView
android:layout_width="95dp"
android:layout_height="95dp"
android:src="#drawable/ic_m_logo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>```
I have the below 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></data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/mainHolder_CL"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="#+id/preview_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
app:srcCompat="#color/mcorner_page_background" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/title"
style="#style/HomeScreenTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="#string/screen_title_corners"
app:addWindowInsetMarginTop="#{true}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.cardview.widget.CardView
android:id="#+id/cornerPeace"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="30dp"
android:layout_marginTop="35dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="30dp"
android:background="#android:color/white"
app:cardCornerRadius="10dp"
app:cardElevation="10dp"
app:layout_constraintBottom_toTopOf="#+id/otherCorners"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/title">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="15dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="#+id/peaceImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_bottom_nav_home_new" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="header"
android:textColor="#android:color/black"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/peaceImg" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/desc"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:text="description"
app:layout_constraintBottom_toTopOf="#+id/separator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/header" />
<View
android:id="#+id/separator"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginBottom="5dp"
android:alpha="0.1"
android:background="#android:color/black"
app:layout_constraintBottom_toTopOf="#+id/mins"
app:layout_constraintEnd_toEndOf="#+id/desc"
app:layout_constraintStart_toStartOf="#+id/desc" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/mins"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="minutes"
android:textColor="#android:color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/otherCorners"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="20dp"
app:addBottomNavigationHeightMarginBottom="#{true}"
app:addWindowInsetMarginBottom="#{true}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<androidx.cardview.widget.CardView
android:id="#+id/corner1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#android:color/white"
app:cardElevation="10dp"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toStartOf="#+id/corner2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="#+id/challengeImg"
android:layout_width="50dp"
android:layout_height="50dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_bottom_nav_home_new" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/challengesTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="corner 1"
android:textSize="13sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/challengeImg" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="#+id/corner2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:background="#android:color/white"
android:clipToPadding="false"
app:cardElevation="10dp"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toStartOf="#+id/corner3"
app:layout_constraintStart_toEndOf="#+id/corner1"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="#+id/humourImg"
android:layout_width="50dp"
android:layout_height="50dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_bottom_nav_home_new" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="corner 2"
android:textSize="13sp"
app:fontFamily="#font/font_regular"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/humourImg" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="#+id/corner3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:clipToPadding="false"
app:cardElevation="10dp"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/corner2"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="#+id/thoughtImg"
android:layout_width="50dp"
android:layout_height="50dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_bottom_nav_home_new" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="corner 3"
android:textSize="13sp"
app:fontFamily="#font/font_regular"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/thoughtImg" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
This is the output I get
As you see I applied the elevation to corner 1,2 and 3 but it isn't showing properly.
It seems to be getting cut-off. What am I missing here?
I'd debug the "otherCorners" ConstraintLayout.
You seem to have set the margins of that layout in a way to make it equal to the big CardView above it. And since the first and last CardView inside the otherCorners Layout are placed directly against the borders of the parent it prob just cuts off the shadow of the elevation on the sides. Same story, different values, for the bottom.
I had to introduce a ScrollView in my Dialog layout to display all the layout when the phone is in landscape mode or the app is running on small screens. However, the bottom of the layout is being cut off.
I've tried different things like setting ScrollView's layout_height = "0dp", adding more constraints, replacing the ScrollView with a NestedScrollView and other small things as clipToPadding = false or fillViewPort = true but none of these have worked.
This is my layout currently used in a Dialog I need:
<?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:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/icon_image_container"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="#color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="#+id/icon_image"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#drawable/ic_help_outline_white_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
android:id="#+id/message_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/icon_image_container">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<TextView
android:id="#+id/help_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Headline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/help_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/internal_margin_views"
android:textAlignment="textStart"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/help_title" />
<TextView
android:id="#+id/help_example_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/internal_margin_views"
android:text="#string/help_dialog_example_title"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Headline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/help_message" />
<TextView
android:id="#+id/help_example_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/internal_margin_views"
android:textAlignment="textStart"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/help_example_title" />
<Button
android:id="#+id/help_button_ok"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/internal_margin_views"
android:background="#drawable/button_background"
android:text="#string/help_dialog_button_ok"
android:textAlignment="center"
android:textColor="#color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/help_example_message" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
And this is how it's being displayed with the above xml layout. The image is showing the scrollview scrolled to the bottom as far as possible.
I have been stuck on this a lot. Any help would be much appreciated
Change scrollview height to 0dp and constraint it to the bottom of parent it should solve your issue
<?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:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/icon_image_container"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="#color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="#+id/icon_image"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#drawable/ic_help_outline_white_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
android:id="#+id/message_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scrollbars="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="#id/icon_image_container">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<TextView
android:id="#+id/help_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Headline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/help_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/internal_margin_views"
android:textAlignment="textStart"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/help_title" />
<TextView
android:id="#+id/help_example_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/internal_margin_views"
android:text="#string/help_dialog_example_title"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Headline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/help_message" />
<TextView
android:id="#+id/help_example_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/internal_margin_views"
android:textAlignment="textStart"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/help_example_title" />
<Button
android:id="#+id/help_button_ok"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/internal_margin_views"
android:background="#drawable/button_background"
android:text="#string/help_dialog_button_ok"
android:textAlignment="center"
android:textColor="#color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/help_example_message" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
I post the answer in case anybody encounter the same issue. I just replaced the root layout from ConstraintLayout to LinearLayout with orientation = "vertical" and the same thing for the layout inside the ScrollView.
<?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:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/icon_image_container"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="#color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="#+id/icon_image"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#drawable/ic_help_outline_white_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
android:id="#+id/message_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/icon_image_container">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<TextView
android:id="#+id/help_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Headline" />
<TextView
android:id="#+id/help_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/internal_margin_views"
android:textAlignment="textStart"
android:textAppearance="#style/TextAppearance.AppCompat.Medium" />
<TextView
android:id="#+id/help_example_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/internal_margin_views"
android:text="#string/help_dialog_example_title"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Headline" />
<TextView
android:id="#+id/help_example_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/internal_margin_views"
android:textAlignment="textStart"
android:textAppearance="#style/TextAppearance.AppCompat.Medium" />
<Button
android:id="#+id/help_button_ok"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/internal_margin_views"
android:background="#drawable/button_background"
android:text="#string/help_dialog_button_ok"
android:textAlignment="center"
android:textColor="#color/colorPrimary" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
I have the following xml layout:
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.movie_detail.MovieDetailActivity">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageButton
android:id="#+id/btn_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:src="#drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:textColor="#FFFFFF"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="#id/btn_back"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.appcompat.widget.Toolbar>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="#+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/toolbar">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:padding="16dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/movie_image"
android:layout_width="match_parent"
android:layout_height="300dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/tv_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:textAlignment="center"
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/movie_image" />
<TextView
android:id="#+id/tv_country"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:textAlignment="center"
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/tv_description" />
<TextView
android:id="#+id/tv_runtime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:textAlignment="center"
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/tv_country" />
<TextView
android:id="#+id/tv_released"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:textAlignment="center"
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/tv_runtime" />
<TextView
android:id="#+id/tv_tagline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:textAlignment="center"
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/tv_released" />
<TextView
android:id="#+id/tv_year"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:textAlignment="center"
android:textColor="#000000"
android:text="aaaaaaaa"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/tv_tagline" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/btn_favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:layout_marginBottom="32dp"
android:src="#drawable/ic_favorite"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="#+id/tv_no_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/no_information"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
I added such a big marginTop to all views just to test how scrollview works. And when I open the activity I see this:
So, as you see, there's no year textview in this screen. I specially added default text to display that this problem exists. I watched on the previous questions related to this problem and usually the solution was to add paddings or margins to scrollview. As you can see, I did it and it didn't help. So, what's the problem and how can it be solved?
The bottom margin you have assigned to tv_year will not work until you assign related constraint with it.
So add below attribute in tv_year textview to apply bottom margin too.
app:layout_constraintBottom_toBottomOf="parent"
so your final tv_year view looks like,
<TextView
android:id="#+id/tv_year"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:textAlignment="center"
android:textColor="#000000"
android:text="aaaaaaaa"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/tv_tagline" />
Update:
You have also forget one attribute on SwipeRefreshLayout.
Add below attribute with it.
app:layout_constraintBottom_toBottomOf="parent"
FYI: Also add android:clipToPadding="false" attribute with ScrollView. It'll looks better.
I am using a EditText to get the message from the user but when the message length increases and the EditText goes below other elements on the layout. what should I do prevent it going below those elements? It must be at top of every other element
Tried this in manifest file but dosen't work.
android:windowSoftInputMode="adjustResize"
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".GroupChatActivity"
android:background="#fff">
<TextView
android:id="#+id/admin_text"
android:layout_width="match_parent"
android:layout_height="54dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="ONLY FACULTY CAN SEND MESSAGE"
android:textSize="18sp"
android:textColor="#android:color/black"
android:textAlignment="center"
android:padding="15dp"
android:background="#drawable/text_bg"
android:visibility="invisible"
/>
<androidx.appcompat.widget.Toolbar
android:id="#+id/group_chat_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/group_chat_layout"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="75dp"
android:layout_marginBottom="8dp"
android:background="#drawable/text_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<EditText
android:id="#+id/group_message_text"
android:layout_width="293dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="35dp"
android:layout_marginBottom="4dp"
android:background="#color/transparent"
android:hint="Text Goes Here"
android:padding="10dp"
android:textColor="#android:color/black"
android:textColorHint="#android:color/black"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageButton
android:id="#+id/group_chat_content_add_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/transparent"
android:src="#drawable/attach_file" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageButton
android:id="#+id/group_chat_send_message_button"
android:layout_width="60dp"
android:layout_height="50dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="10dp"
android:background="#color/transparent"
android:src="#drawable/send_image"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#+id/group_chat_layout"
android:visibility="invisible"/>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/group_chat_recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="65dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="70dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="#+id/content_screen"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="#+id/admin_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent">
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
First way
For different Android versions, the best ways is to include these parameters :
android:lines="1"
android:maxLines="1"
android:singleLine="true"
Second way
You can disable the enter (new line) key, set the input type to text :
android:inputType="text"
If you want to have dynamic EditText You can use android:maxLines in Your EditText XML
If you want to have some behaviour between your elements You can use CoordinatorLayout
So as your EditText need to be on the top of all elements you must use CoordinatorLayout
and your final Code must be changed like below
<?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"
android:background="#fff"
tools:context=".GroupChatActivity">
<TextView
android:id="#+id/admin_text"
android:layout_width="match_parent"
android:layout_height="54dp"
android:layout_gravity="top"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="#drawable/text_bg"
android:padding="15dp"
android:text="ONLY FACULTY CAN SEND MESSAGE"
android:textAlignment="center"
android:textColor="#android:color/black"
android:textSize="18sp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<androidx.appcompat.widget.Toolbar
android:id="#+id/group_chat_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme" />
<LinearLayout
android:id="#+id/group_chat_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="8dp"
android:layout_marginBottom="8dp"
android:background="#drawable/text_bg"
android:orientation="horizontal"
android:visibility="visible">
<ImageButton
android:id="#+id/group_chat_content_add_button"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#color/transparent"
android:src="#drawable/attach_file" />
<EditText
android:id="#+id/group_message_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="35dp"
android:layout_marginBottom="4dp"
android:layout_weight="4"
android:background="#color/transparent"
android:hint="Text Goes Here"
android:maxLines="3"
android:padding="10dp"
android:textColor="#android:color/black"
android:textColorHint="#android:color/black"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout>
<ImageButton
android:id="#+id/group_chat_send_message_button"
android:layout_width="60dp"
android:layout_height="50dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="10dp"
android:background="#color/transparent"
android:src="#drawable/send_image"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#+id/group_chat_layout" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/group_chat_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_marginTop="60dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="70dp"
app:layout_constraintBottom_toBottomOf="#id/group_chat_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/group_chat_toolbar" />
<FrameLayout
android:id="#+id/content_screen"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_gravity="bottom"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="80dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>