I want to prevent imageview(1) from going below edittext(2)(In small screens happening) but i don't want to constraint it with bottom view because it adds margin which is not the case.. I added both barrier and guideline but they function with setting constraints to bottom ..How can i do that? Here is the code of xml layout
<pre><code>
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="gr.zag.community.view.auth.AuthenticationViewModel" />
</data>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:enabled="false"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/login_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context="gr.zag.community.view.auth.LoginFragment">
<androidx.constraintlayout.widget.Group
android:id="#+id/login_components"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="login_header,register_btn,register_text,register_line,forgot_password_text,login_btn,login_email_layout,login_email_layout_line,login_password_layout,login_password_layout_line"
tools:visibility="visible" />
<ImageView
android:id="#+id/login_header"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginStart="24dp"
android:layout_marginTop="32dp"
android:visibility="gone"
app:layout_constraintHeight_percent="0.10"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.46"
app:srcCompat="#drawable/ic_logo" />
<ImageView
android:id="#+id/replay_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#id/login_header"
app:srcCompat="#drawable/ic_replay" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/login_email_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_marginEnd="14dp"
android:layout_marginBottom="32dp"
android:background="#null"
android:color="#color/Gray3"
android:textColorHint="#color/Gray3"
android:theme="#style/EditProfileEditTextTheme"
android:visibility="gone"
app:boxBackgroundColor="#color/transparent"
app:boxStrokeColor="#color/white"
app:boxStrokeWidth="0dp"
app:hintEnabled="false"
app:hintTextAppearance="#style/small_text_bold"
app:hintTextColor="#color/Gray3"
app:layout_constraintBottom_toTopOf="#+id/login_password_layout"
app:layout_constraintEnd_toEndOf="#id/login_header"
app:layout_constraintStart_toStartOf="#id/login_header">
<EditText
android:id="#+id/login_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:color="#color/Black"
android:hint="#string/login_email_hint"
android:singleLine="true"
android:text="#={viewModel.email}"
android:textAppearance="#style/caption_bold"
android:textColor="#color/textColorSecondary"
app:dynamicFontSize="#{true}"
tools:text="#string/email" />
</com.google.android.material.textfield.TextInputLayout>
<View
android:id="#+id/login_email_layout_line"
android:layout_width="0dp"
android:layout_height="4dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:background="#drawable/rebranding_background_ellipse"
android:backgroundTint="#color/Gray3"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/login_email_layout" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/login_password_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_marginTop="28dp"
android:layout_marginEnd="14dp"
android:background="#null"
android:color="#color/Gray3"
android:textColorHint="#color/Gray3"
android:theme="#style/EditProfileEditTextTheme"
android:visibility="gone"
app:boxBackgroundColor="#color/transparent"
app:boxStrokeColor="#color/white"
app:boxStrokeWidth="0dp"
app:endIconMode="custom"
app:endIconTint="#color/black"
app:hintEnabled="false"
app:hintTextAppearance="#style/small_text_bold"
app:hintTextColor="#color/Gray3"
app:layout_constraintEnd_toEndOf="#id/login_email_layout"
app:layout_constraintStart_toStartOf="#id/login_email_layout"
app:layout_constraintTop_toBottomOf="#+id/login_email_layout_line">
<EditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:color="#color/Black"
android:hint="#string/login_password_hint"
android:inputType="textPassword"
android:singleLine="true"
android:text="#={viewModel.password}"
android:textAppearance="#style/caption_bold"
android:textColor="#color/textColorSecondary"
app:dynamicFontSize="#{true}"
tools:text="#string/password_label" />
</com.google.android.material.textfield.TextInputLayout>
<View
android:id="#+id/login_password_layout_line"
android:layout_width="0dp"
android:layout_height="4dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:background="#drawable/rebranding_background_ellipse"
android:backgroundTint="#color/Gray3"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/login_password_layout" />
<TextView
android:id="#+id/login_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="38dp"
android:layout_marginEnd="24dp"
android:background="#drawable/rebranding_rounded_black"
android:onClick="#{(v) -> viewModel.onLoginClicked(v)}"
android:paddingHorizontal="32dp"
android:paddingVertical="14dp"
android:text="#string/login_button_text"
android:textAlignment="center"
android:textAppearance="#style/button_medium"
android:textColor="#color/CoolGray"
android:visibility="gone"
app:dynamicFontSize="#{true}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/login_password_layout_line" />
<TextView
android:id="#+id/forgot_password_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="#string/login_forgot_password_text"
android:textAlignment="center"
android:textAppearance="#style/small_text"
android:textColor="#color/Gray3"
android:textColorLink="#color/black"
android:visibility="gone"
app:dynamicFontSize="#{true}"
app:layout_constraintEnd_toEndOf="#+id/login_password_layout"
app:layout_constraintStart_toStartOf="#+id/login_password_layout"
app:layout_constraintTop_toBottomOf="#+id/login_btn"
tools:text="ξέχασες τον κωδικό σου; πάτα εδώ και όλα καλά!" />
<View
android:id="#+id/register_line"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="57dp"
android:layout_marginBottom="20dp"
android:background="#color/CoolGray"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="#+id/register_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/forgot_password_text"
app:layout_constraintVertical_bias="1" />
<TextView
android:id="#+id/register_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="#string/login_register_text"
android:textAppearance="#style/caption_bold"
android:visibility="gone"
app:dynamicFontSize="#{true}"
app:layout_constraintBottom_toTopOf="#+id/register_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="#+id/register_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="22dp"
android:background="#drawable/rebranding_rounded_black"
android:backgroundTint="#color/CoolGray"
android:paddingHorizontal="32dp"
android:paddingVertical="14dp"
android:text="#string/login_register_button_text"
android:textAlignment="center"
android:textAppearance="#style/button_medium"
android:textColor="#color/Black2"
android:visibility="gone"
app:dynamicFontSize="#{true}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
Related
I have recently upgraded my studio to artic fox. I am trying to make changes in my xml and add textView but I get this error :
error: cannot find symbol
binding.tvUserBio2.setText("LETS MAKE THIS HAPPEN");
^
symbol: variable tvUserBio2
location: variable binding of type FragmentProfileBinding
I try to clean the build, invalidate and cache studio but still it does not work. Can anyone help?
This is my XML. I try to add any textview anywhere in the XML I get the same error.
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/ui_background">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="24dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/constraint_layout_profile_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:paddingBottom="21dp"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/iv_user_profile_pic"
android:layout_width="104dp"
android:layout_height="104dp"
android:src="#drawable/placeholder_profile"
app:layout_constraintBottom_toBottomOf="#id/level_progress_bar"
app:layout_constraintLeft_toLeftOf="#id/level_progress_bar"
app:layout_constraintRight_toRightOf="#id/level_progress_bar"
app:layout_constraintTop_toTopOf="#id/level_progress_bar"
app:shapeAppearanceOverlay="#style/CircularImageView" />
<ProgressBar
android:id="#+id/level_progress_bar"
style="#style/CircularDeterminateProgressBar"
android:layout_width="157dp"
android:layout_height="157dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:progress="60" />
<TextView
android:id="#+id/tv_profile_user_name"
style="#style/SemiBoldFont.Size16_Body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="11dp"
android:layout_marginRight="16dp"
android:ellipsize="marquee"
android:gravity="center"
android:lineSpacingExtra="-10dp"
android:maxLines="3"
android:textColor="#color/gray_30_3B4345"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/level_progress_bar"
tools:text="Impact\nUser" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="#+id/constraint_layout_user_titles"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
app:layout_constraintLeft_toLeftOf="#id/guideline_middle"
app:layout_constraintRight_toRightOf="#id/guideline_middle"
app:layout_constraintTop_toBottomOf="#id/tv_profile_user_name">
<TextView
android:id="#+id/tv_user_top_1_per"
style="#style/RegularFont.Size10_Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:background="#drawable/button_rounded_corner_border_bg"
android:paddingLeft="8dp"
android:paddingTop="4dp"
android:paddingRight="8dp"
android:paddingBottom="4dp"
android:textColor="#color/blue_40_0091B6"
app:layout_constraintTop_toTopOf="parent"
tools:text="TOP 1%" />
<TextView
android:id="#+id/tv_user_title"
style="#style/RegularFont.Size10_Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:background="#drawable/button_rounded_corner_border_bg"
android:paddingLeft="8dp"
android:paddingTop="4dp"
android:paddingRight="8dp"
android:paddingBottom="4dp"
android:textAllCaps="true"
android:textColor="#color/blue_40_0091B6"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:text="HERO FOR RUN" />
<TextView
android:id="#+id/tv_user_current_streak"
style="#style/RegularFont.Size10_Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:background="#drawable/button_rounded_corner_bg_f2f3f4"
android:drawablePadding="4dp"
android:paddingLeft="8dp"
android:paddingTop="4dp"
android:paddingRight="8dp"
android:paddingBottom="4dp"
android:textAllCaps="true"
android:textColor="#color/red_60_F55A33"
app:drawableEndCompat="#drawable/ic_streak_icon"
tools:text="99999" />
</androidx.appcompat.widget.LinearLayoutCompat>
<TextView
android:id="#+id/tv_user_bio"
style="#style/RegularFont.Size12_Caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:layout_marginRight="30dp"
android:gravity="center"
android:lineSpacingExtra="-8dp"
android:textColor="#color/gray_60_919DA1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/constraint_layout_user_titles"
tools:text="100 pushups, 100 sit-ups, 100 squats\nand a 10km run!" />
<TextView
android:id="#+id/tv_user_bio_2"
style="#style/RegularFont.Size12_Caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:layout_marginRight="30dp"
android:gravity="center"
android:lineSpacingExtra="-8dp"
android:textColor="#color/gray_60_919DA1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/tv_user_bio"
tools:text="100 pushups, 100 sit-ups, 100 squats\nand a 10km run!" />
<androidx.constraintlayout.widget.Guideline
android:id="#+id/guideline_middle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />
<TextView
android:id="#+id/tv_user_impact"
style="#style/SemiBoldFont.Size20_Heading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textColor="#color/gray_30_3B4345"
app:layout_constraintLeft_toLeftOf="#+id/guideline_middle"
app:layout_constraintRight_toRightOf="#+id/guideline_middle"
app:layout_constraintTop_toBottomOf="#+id/tv_user_bio"
tools:text="₹20,000" />
<TextView
android:id="#+id/tv_donated_caption"
style="#style/RegularFont.Size10_Caption.Profile_Impact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/profile_caption_donated"
app:layout_constraintLeft_toLeftOf="#+id/guideline_middle"
app:layout_constraintRight_toRightOf="#+id/guideline_middle"
app:layout_constraintTop_toBottomOf="#+id/tv_user_impact" />
<TextView
android:id="#+id/tv_user_distance"
style="#style/MediumFont.Size14_Body.Profile_Impact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="#+id/tv_user_impact"
app:layout_constraintLeft_toLeftOf="#+id/tv_distance_caption"
app:layout_constraintRight_toRightOf="#+id/tv_distance_caption"
app:layout_constraintTop_toTopOf="#+id/tv_user_impact"
tools:text="20000 km"
/>
<TextView
android:id="#+id/tv_distance_caption"
style="#style/RegularFont.Size10_Caption.Profile_Impact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/profile_caption_distance"
app:layout_constraintHorizontal_bias="0.4"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="#id/tv_donated_caption"
app:layout_constraintTop_toTopOf="#id/tv_donated_caption" />
<TextView
android:id="#+id/tv_user_max_streak"
style="#style/MediumFont.Size14_Body.Profile_Impact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="#+id/tv_user_impact"
app:layout_constraintLeft_toLeftOf="#+id/tv_max_streak_caption"
app:layout_constraintRight_toRightOf="#+id/tv_max_streak_caption"
app:layout_constraintTop_toTopOf="#+id/tv_user_impact"
tools:text="20000" />
<TextView
android:id="#+id/tv_max_streak_caption"
style="#style/RegularFont.Size10_Caption.Profile_Impact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/profile_caption_max_streak"
app:layout_constraintHorizontal_bias="0.6"
app:layout_constraintLeft_toRightOf="#+id/guideline_middle"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_user_impact" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.cardview.widget.CardView
android:id="#+id/card_view_profile_achievements"
style="#style/CardView_Profile_Background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/constraint_layout_profile_header">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tv_achievement_card_title"
style="#style/SemiBoldFont.Size14_Body.Profile_Card_Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/profile_achievements_title"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.button.MaterialButton
android:id="#+id/btn_achievement_see_more"
style="#style/SemiBoldFont.Size8_Caption.Profile_Card_Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/profile_see_more_button_text"
app:layout_constraintBottom_toBottomOf="#+id/tv_achievement_card_title"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/tv_achievement_card_title" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_achievements"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_achievement_card_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="#+id/card_view_profile_in_progress"
style="#style/CardView_Profile_Background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentPadding="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/card_view_profile_achievements">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tv_in_progress_title"
style="#style/SemiBoldFont.Size14_Body.Profile_Card_Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="#string/profile_in_progress_title"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/btn_in_progress_see_more"
style="#style/SemiBoldFont.Size8_Caption.Profile_Card_Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:text="#string/profile_see_more_button_text"
app:layout_constraintBottom_toBottomOf="#+id/tv_in_progress_title"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/tv_in_progress_title" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_in_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_in_progress_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="#+id/card_view_profile_steps"
style="#style/CardView_Profile_Background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/card_view_profile_in_progress">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tv_steps_title"
style="#style/SemiBoldFont.Size14_Body.Profile_Card_Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="12dp"
android:text="#string/profile_steps_title"
app:drawableLeftCompat="#drawable/ic_profile_steps_icon"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tv_steps_date"
style="#style/MediumFont.Size12_Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/profile_steps_title"
android:textColor="#color/gray_50_75858A"
app:layout_constraintBottom_toBottomOf="#id/tv_steps_title"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#id/tv_steps_title"
tools:text="04th july '21, Sun" />
<Button
android:id="#+id/btn_steps_see_more"
style="#style/SemiBoldFont.Size8_Caption.Profile_Card_Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/profile_see_more_button_text"
app:layout_constraintBottom_toBottomOf="#+id/tv_steps_title"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/tv_steps_title" />
<com.github.mikephil.charting.charts.BarChart
android:id="#+id/steps_bar_chart"
android:layout_width="0dp"
android:layout_height="150dp"
app:layout_constraintLeft_toLeftOf="#id/tv_steps_title"
app:layout_constraintRight_toRightOf="#id/btn_steps_see_more"
app:layout_constraintTop_toBottomOf="#+id/tv_steps_title"
android:layout_marginTop="20dp"
android:visibility="gone"
/>
<TextView
android:id="#+id/my_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="#+id/steps_bar_chart_layout"
android:layout_width="0dp"
android:layout_height="150dp"
app:layout_constraintLeft_toLeftOf="#id/tv_steps_title"
app:layout_constraintRight_toRightOf="#id/btn_steps_see_more"
app:layout_constraintTop_toBottomOf="#+id/tv_steps_title"
android:layout_marginTop="20dp"
android:orientation="horizontal"
></LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="#+id/card_view_profile_recent_workout"
style="#style/CardView_Profile_Background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/card_view_profile_steps">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tv_recent_workout_title"
style="#style/SemiBoldFont.Size14_Body.Profile_Card_Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/profile_recent_workout_title"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/btn_recent_workout_see_more"
style="#style/SemiBoldFont.Size8_Caption.Profile_Card_Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/profile_see_more_button_text"
app:layout_constraintBottom_toBottomOf="#+id/tv_recent_workout_title"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/tv_recent_workout_title" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_recent_workout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_recent_workout_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="#+id/card_view_profile_charity_overview"
style="#style/CardView_Profile_Background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/card_view_profile_recent_workout">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tv_charity_overview_title"
style="#style/SemiBoldFont.Size14_Body.Profile_Card_Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/profile_charity_overview_title"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/btn_charity_overview_see_more"
style="#style/SemiBoldFont.Size8_Caption.Profile_Card_Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/profile_see_more_button_text"
app:layout_constraintBottom_toBottomOf="#+id/tv_charity_overview_title"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/tv_charity_overview_title" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_charity_overview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_charity_overview_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
There is only tv_user_bio on your xml. It means binding.tvUserBio. Why do you put 2, end of variable of tvUserBio2?
I am developing android app and I have implemented constrainlayout but in real device password edit text and register button overlapping to each other I want to empty space between them how can achieve that
below my currentlayout
<?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"
android:background="#color/white">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/constraintLayout"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="100dp"
android:background="#drawable/circle_back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_person">
<ImageView
android:id="#+id/person_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/empty"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_person" />
</androidx.constraintlayout.widget.ConstraintLayout>
<EditText
android:id="#+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="16dp"
android:hint="#string/firstname"
style="#style/textFieldStyle"
android:inputType="textEmailAddress"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/constraintLayout"
tools:ignore="RtlSymmetry"
android:autofillHints="" />
<EditText
android:id="#+id/email"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
style="#style/textFieldStyle"
android:hint="#string/email"
android:inputType="textEmailAddress"
app:layout_constraintEnd_toEndOf="#+id/name"
app:layout_constraintStart_toStartOf="#+id/name"
app:layout_constraintTop_toBottomOf="#+id/lastName"
tools:ignore="TextFields" />
<Button
android:id="#+id/registration"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginBottom="40dp"
android:backgroundTint="#color/gray"
android:fontFamily="#font/roboto_black"
android:padding="16dp"
android:text="#string/register"
app:layout_constraintBottom_toTopOf="#+id/already_have_account"
app:layout_constraintEnd_toEndOf="#+id/password"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="#+id/already_have_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:text="#string/already_have_an_account"
android:textColor="#color/primaryBlack"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.33"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="#+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:text="#string/login"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.73"
app:layout_constraintStart_toStartOf="parent" />
<EditText
android:id="#+id/password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:hint="#string/password"
android:inputType="textPassword"
style="#style/textFieldStyle"
app:layout_constraintEnd_toEndOf="#+id/email"
app:layout_constraintStart_toStartOf="#+id/email"
app:layout_constraintTop_toBottomOf="#+id/email" />
<EditText
android:id="#+id/lastName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
style="#style/textFieldStyle"
android:hint="#string/lastName"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="#+id/name"
app:layout_constraintStart_toStartOf="#+id/name"
app:layout_constraintTop_toBottomOf="#+id/name" />
</androidx.constraintlayout.widget.ConstraintLayout>
following screenshot in real device I want to know what I have to do in order to put space between password and register button
but I want to see in real device as if you see there space between password and register button
Add a constraint from the top of the register button to the bottom of the password field. Every element should have a top and bottom constraint to not overlap another element that is above or below it.
When you do something like android:layout_marginBottom="40dp", you will eventually get some views overlapping and that's because you are using hardcoded values, you want to adjust your views to the size of your screen in a responsive way.
You can do it using Guidelines, app:layout_constraintHeight_percent="0.xx" and chain verticly your views:
Inside you constarintLayout (I have used a single layout)
<ImageView
android:id="#+id/imageView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#+id/editTextTextPersonName"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toStartOf="#+id/guideline4"
app:layout_constraintHeight_percent="0.25"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="#+id/guideline3"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="#tools:sample/backgrounds/scenic" />
<EditText
android:id="#+id/editTextTextPersonName"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintHeight_percent="0.07"
android:ems="10"
android:inputType="textPersonName"
android:text="FirstName"
app:layout_constraintBottom_toTopOf="#+id/editTextTextPersonName2"
app:layout_constraintEnd_toStartOf="#+id/guideline4"
app:layout_constraintStart_toStartOf="#+id/guideline3"
app:layout_constraintTop_toBottomOf="#+id/imageView" />
<EditText
android:id="#+id/editTextTextPersonName2"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintHeight_percent="0.07"
android:ems="10"
android:inputType="textPersonName"
android:text="LastName"
app:layout_constraintBottom_toTopOf="#+id/editTextTextPersonName3"
app:layout_constraintEnd_toEndOf="#+id/editTextTextPersonName"
app:layout_constraintStart_toStartOf="#+id/editTextTextPersonName"
app:layout_constraintTop_toBottomOf="#+id/editTextTextPersonName" />
<EditText
android:id="#+id/editTextTextPersonName3"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintHeight_percent="0.07"
android:ems="10"
android:inputType="textPersonName"
android:text="Email"
app:layout_constraintBottom_toTopOf="#+id/editTextTextPersonName4"
app:layout_constraintEnd_toEndOf="#+id/editTextTextPersonName"
app:layout_constraintStart_toStartOf="#+id/editTextTextPersonName"
app:layout_constraintTop_toBottomOf="#+id/editTextTextPersonName2" />
<EditText
android:id="#+id/editTextTextPersonName4"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintHeight_percent="0.07"
android:ems="10"
android:inputType="textPersonName"
android:text="Password"
app:layout_constraintBottom_toTopOf="#+id/button"
app:layout_constraintEnd_toEndOf="#+id/editTextTextPersonName"
app:layout_constraintStart_toStartOf="#+id/editTextTextPersonName"
app:layout_constraintTop_toBottomOf="#+id/editTextTextPersonName3" />
<Button
android:id="#+id/button"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintHeight_percent="0.07"
android:text="Register"
app:layout_constraintBottom_toTopOf="#+id/guideline2"
app:layout_constraintEnd_toEndOf="#+id/editTextTextPersonName4"
app:layout_constraintStart_toStartOf="#+id/editTextTextPersonName4"
app:layout_constraintTop_toBottomOf="#+id/editTextTextPersonName4" />
<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.85" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Already have account?"
app:layout_constraintBottom_toBottomOf="#+id/textView2"
app:layout_constraintEnd_toStartOf="#+id/textView2"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/textView2" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Log in"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/textView"
app:layout_constraintTop_toTopOf="#+id/guideline2" />
<androidx.constraintlayout.widget.Guideline
android:id="#+id/guideline3"
android:layout_width="wrap_content"
app:layout_constraintGuide_percent="0.05"
android:layout_height="wrap_content"
android:orientation="vertical" />
<androidx.constraintlayout.widget.Guideline
android:id="#+id/guideline4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintGuide_percent="0.95"
android:orientation="vertical" />
It will look like this (arrows pointing to the guidelines):
Adding app:layout_constraintTop_toBottomOf.
<Button
android:id="#+id/registration"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginBottom="40dp"
android:backgroundTint="#color/gray"
android:fontFamily="#font/roboto_black"
android:padding="16dp"
android:text="#string/register"
app:layout_constraintBottom_toTopOf="#+id/already_have_account"
app:layout_constraintEnd_toEndOf="#+id/password"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/password" />
Adding app:layout_constraintBottom_toTopOf="#id/registration"
<EditText
android:id="#+id/password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:hint="#string/password"
android:inputType="textPassword"
style="#style/textFieldStyle"
app:layout_constraintEnd_toEndOf="#+id/email"
app:layout_constraintStart_toStartOf="#+id/email"
app:layout_constraintTop_toBottomOf="#+id/email"
app:layout_constraintBottom_toTopOf="#id/registration" />
The above solution works only when all of your views are within a single screen. If height of the View is bigger than the screen, then you may need ScrollView or other method.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white">
... your main content here ...
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</ScrollView>
Adding ScrollView and LinearLayout outside your main content ConstraintLayout solves the overlapping issue, and allow bigger view to scroll on smaller view.
Try increasing the margin_botton of the password field and also decreasing margin_botton of the Button.
The Problem is that your register button is bottom aligned, while the above elements are top aligned, which means they will overlap on smaller screens.
Try updating your Register button in the following way to enforce a minimum top margin with the password field if there is too little space (I just added a constraint to the password field, set constraintVerticalbias to 1.0 and set a topMargin):
<Button
android:id="#+id/registration"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="ENTER YOUR TOP MARGIN HERE"
android:layout_marginBottom="40dp"
android:backgroundTint="#color/gray"
android:fontFamily="#font/roboto_black"
android:padding="16dp"
android:text="#string/register"
app:layout_constraintBottom_toTopOf="#+id/already_have_account"
app:layout_constraintEnd_toEndOf="#+id/password"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/password"
app:layout_constraintVertical_bias="1.0" />
IMPORTANT: To make this work you need to wrap your screen in a Scrollview with android:fillViewport="true".
Here would be your whole layout reworked so that it should work (with registerbutton minimum top margin of 40dp):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/constraintLayout"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="100dp"
android:background="#drawable/circle_back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_person">
<ImageView
android:id="#+id/person_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/empty"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_person" />
</LinearLayout>
<EditText
android:id="#+id/name"
style="#style/textFieldStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="16dp"
android:autofillHints=""
android:hint="#string/firstname"
android:inputType="textEmailAddress"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/constraintLayout"
tools:ignore="RtlSymmetry" />
<EditText
android:id="#+id/email"
style="#style/textFieldStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:hint="#string/email"
android:inputType="textEmailAddress"
app:layout_constraintEnd_toEndOf="#+id/name"
app:layout_constraintStart_toStartOf="#+id/name"
app:layout_constraintTop_toBottomOf="#+id/lastName"
tools:ignore="TextFields" />
<Button
android:id="#+id/registration"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="40dp"
android:layout_marginBottom="40dp"
android:backgroundTint="#color/gray"
android:fontFamily="#font/roboto_black"
android:padding="16dp"
android:text="#string/register"
app:layout_constraintBottom_toTopOf="#+id/already_have_account"
app:layout_constraintEnd_toEndOf="#+id/password"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/password"
app:layout_constraintVertical_bias="1.0" />
<TextView
android:id="#+id/already_have_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:text="#string/already_have_an_account"
android:textColor="#color/primaryBlack"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.33"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="#+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:text="#string/login"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.73"
app:layout_constraintStart_toStartOf="parent" />
<EditText
android:id="#+id/password"
style="#style/textFieldStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:hint="#string/password"
android:inputType="textPassword"
app:layout_constraintEnd_toEndOf="#+id/email"
app:layout_constraintStart_toStartOf="#+id/email"
app:layout_constraintTop_toBottomOf="#+id/email" />
<EditText
android:id="#+id/lastName"
style="#style/textFieldStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:hint="#string/lastName"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="#+id/name"
app:layout_constraintStart_toStartOf="#+id/name"
app:layout_constraintTop_toBottomOf="#+id/name" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</LinearLayout>
I would like to check if there's a collision between Text Views, if there is, ellipsis should be displayed instead of them colliding with each other.
I already tried this, but it doesn't work on mine (probably because of the font family that I'm currently using, too many spaces)
Here's some of the XML code, (I'm using Constraint 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=".SettingsActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="55dp"
android:layout_marginBottom="55dp"
tools:context=".MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="30dp"
tools:context=".SettingsActivity">
<TextView
android:id="#+id/screenText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="16dp"
android:text="Screen"
android:textColor="#color/colorPrimary"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/songsText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="16dp"
android:text="Songs"
android:textColor="#color/colorPrimary"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/splitLine_hor3" />
<Spinner
android:id="#+id/fontSizeInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:gravity="right"
android:padding="0dp"
android:paddingEnd="32dp"
android:paddingRight="32dp"
android:spinnerMode="dialog"
android:divider="#8e8e8e"
app:layout_constraintBottom_toBottomOf="#+id/fontSizeText"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/fontSizeText" />
<Spinner
android:id="#+id/fontFamilyInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:padding="0dp"
android:paddingEnd="32dp"
android:paddingRight="32dp"
android:spinnerMode="dialog"
app:layout_constraintBottom_toBottomOf="#+id/fontFamilyText"
app:layout_constraintEnd_toEndOf="#+id/fontSizeInput"
app:layout_constraintTop_toTopOf="#+id/fontFamilyText" />
<Spinner
android:id="#+id/searchUsingInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:padding="0dp"
android:paddingEnd="32dp"
android:paddingRight="32dp"
android:spinnerMode="dialog"
app:layout_constraintBottom_toBottomOf="#+id/searchUsingText"
app:layout_constraintEnd_toEndOf="#+id/darkModeInput"
app:layout_constraintTop_toTopOf="#+id/searchUsingText" />
<Spinner
android:id="#+id/displayOrderInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:padding="0dp"
android:paddingRight="32dp"
android:singleLine="true"
android:spinnerMode="dialog"
app:layout_constraintBottom_toBottomOf="#+id/displayOrderText"
app:layout_constraintEnd_toEndOf="#+id/searchUsingInput"
app:layout_constraintTop_toTopOf="#+id/displayOrderText"
android:paddingEnd="32dp" />
<TextView
android:id="#+id/fontSizeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="12dp"
android:text="Font Size"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/screenText" />
<View
android:id="#+id/SplitLine_hor1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:background="#color/colorGray"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/fontSizeText" />
<View
android:id="#+id/splitLine_hor"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:background="#color/colorGray"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/fontFamilyText" />
<View
android:id="#+id/splitLine_hor2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:background="#color/colorGray"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/copyTextText" />
<View
android:id="#+id/splitLine_hor3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:background="#color/colorGray"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/darkModeText" />
<View
android:id="#+id/splitLine_hor4"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:background="#color/colorGray"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/searchUsingText" />
<View
android:id="#+id/splitLine_hor5"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:background="#color/colorGray"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/displayOrderText" />
<View
android:id="#+id/splitLine_hor7"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:background="#color/colorGray"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/swipeHymnText" />
<TextView
android:id="#+id/fontFamilyText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="Font Family"
app:layout_constraintStart_toStartOf="#+id/fontSizeText"
app:layout_constraintTop_toBottomOf="#+id/SplitLine_hor1" />
<TextView
android:id="#+id/copyTextText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="Copy Texts"
app:layout_constraintStart_toStartOf="#+id/fontFamilyText"
app:layout_constraintTop_toBottomOf="#+id/splitLine_hor" />
<TextView
android:id="#+id/darkModeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="Dark Mode"
app:layout_constraintStart_toStartOf="#+id/copyTextText"
app:layout_constraintTop_toBottomOf="#+id/splitLine_hor2" />
<TextView
android:id="#+id/searchUsingText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="Search Using"
app:layout_constraintStart_toStartOf="#+id/darkModeText"
app:layout_constraintTop_toBottomOf="#+id/songsText" />
<TextView
android:id="#+id/displayOrderText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="Display Order"
app:layout_constraintStart_toStartOf="#+id/searchUsingText"
app:layout_constraintTop_toBottomOf="#+id/splitLine_hor4" />
<TextView
android:id="#+id/swipeHymnText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="Swipe Through Songs"
app:layout_constraintStart_toStartOf="#+id/displayOrderText"
app:layout_constraintTop_toBottomOf="#+id/splitLine_hor5" />
<Switch
android:id="#+id/copyTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="#+id/copyTextText"
app:layout_constraintEnd_toEndOf="#+id/fontFamilyInput" />
<Switch
android:id="#+id/darkModeInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="#+id/darkModeText"
app:layout_constraintEnd_toEndOf="#+id/copyTextInput" />
<Switch
android:id="#+id/swipeHymnInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="#+id/swipeHymnText"
app:layout_constraintEnd_toEndOf="#+id/displayOrderInput" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
Try nesting a horizontal linear layout inside your constraint layout. Place it where your
fontFamilyInput spinner is currently located. Next, place your fontFamilyText TextView and your fontFamilyInput spinner (in that order) inside the linear layout.
You can now use weights inside the two child views to declare where on the screen the text view stops and the spinner begins.
However, remember that this is just one approach.
Try adding this to your TextView MaxEms determins the number of character before ellipsis is shown
android:ellipsize="end"
android:maxEms="15"
android:singleLine="true"
I am using ConstraintLayout in fragment.
When I create vertical chain with my views a blank spaces appear on top and bottom.
Without chain there is no blank spaces.
I am using:
com.google.android.material:material:1.1.0
androidx.constraintlayout:constraintlayout:2.0.0-beta5
Here is my layout of fragment is:
<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>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".login.screens.login.LoginFragment"
>
<LinearLayout
android:id="#+id/tv_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/ic_ellipse_h284_w360"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#+id/til_phone_number"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome User!" />
</LinearLayout>
<EditText
android:id="#+id/til_phone_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_title"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:hint="Phone number"
android:inputType="phone"
app:layout_constraintBottom_toTopOf="#+id/til_password"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_title" />
<EditText
android:id="#+id/til_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_title"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:hint="Password"
android:inputType="textPassword"
app:layout_constraintBottom_toTopOf="#+id/tv_forgot_password"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/til_phone_number"
app:passwordToggleEnabled="true" />
<TextView
android:id="#+id/tv_forgot_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/til_password"
android:padding="10dp"
android:paddingStart="30dp"
android:text="Forgot password"
android:textAlignment="textStart"
android:textColor="#color/text_blue"
app:layout_constraintBottom_toTopOf="#+id/btn_login"
app:layout_constraintTop_toBottomOf="#+id/til_password"
tools:layout_editor_absoluteX="24dp" />
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_forgot_password"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:text="Login"
android:translationZ="2dp"
app:layout_constraintBottom_toTopOf="#+id/btn_pin"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_forgot_password" />
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/btn_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/iv_phone"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:text="Use pin"
android:translationZ="2dp"
app:layout_constraintBottom_toTopOf="#+id/view_center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/btn_login" />
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/btn_signup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/iv_phone"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:text="Sign up"
android:translationZ="2dp"
app:layout_constraintBottom_toTopOf="#+id/iv_phone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/view_center" />
<TextView
android:id="#+id/view_center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/or"
android:textAlignment="center"
android:textColor="#color/filter_black1"
android:translationZ="2dp"
app:layout_constraintBottom_toTopOf="#+id/btn_signup"
app:layout_constraintTop_toBottomOf="#+id/btn_pin" />
<TextView
android:id="#+id/iv_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="16dp"
android:src="#drawable/phone_2"
android:text="v1.0"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/btn_signup" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Activity layout is:
<merge 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"
tools:context=".login.screens.login.LoginActivity">
<fragment
android:id="#+id/myNavHostFragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:navGraph="#navigation/navigation"
app:defaultNavHost="true"
/>
</merge>
Why blank space appears? How do I get rid of it?
If you not define layout_constraintVertical_chainStyle default is Spread if you want to remove top and bottom space you can define it to app:layout_constraintVertical_chainStyle="spread_inside" more detail you check here
I have two layouts with ConstraintLayout which has a child NestedScrollview and NestedScrollview have a child ConstraintLayout again as a container than other views. I want animate both layouts using ConstraintSet but unfortunately, this is not working. On other hands, if I remove NestedScrollview and root ConstraintLayout then it works fine. I want to achieve this task with NestedScrollview or Scroll view is this possible? Thanks in advance.
Here is my Code
activity_login.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/root_lay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:isScrollContainer="true"
android:orientation="vertical"
tools:context=".activity.LoginActivity">
<!-- Login progress -->
<android.support.v4.widget.NestedScrollView
android:id="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="8dp">
<!-- Login progress -->
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/root_lay_la"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:gravity="center"
android:orientation="vertical"
tools:context=".activity.LoginActivity">
<ImageView
android:id="#+id/iv_login_back"
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/nature" />
<ProgressBar
android:id="#+id/pb_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tv_login_heading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:gravity="center"
android:paddingStart="#dimen/fab_margin"
android:paddingTop="#dimen/small_padding"
android:paddingEnd="#dimen/fab_margin"
android:paddingBottom="#dimen/small_padding"
android:text="Login Heading"
android:textColor="#color/white"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="#+id/btn_sign_in_la"
android:layout_width="0dp"
android:layout_height="#dimen/button_size"
android:layout_gravity="center_horizontal"
android:layout_marginStart="#dimen/fab_margin"
android:layout_marginTop="32dp"
android:layout_marginEnd="#dimen/fab_margin"
android:layout_marginBottom="8dp"
android:background="#drawable/login_btn_back"
android:paddingStart="#dimen/button_padding"
android:paddingTop="#dimen/normal_padding"
android:paddingEnd="#dimen/button_padding"
android:paddingBottom="#dimen/normal_padding"
android:text="#string/sign_in"
android:textAllCaps="false"
android:textColor="#color/primaryDark"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="#+id/iv_login_back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/et_password_la"
app:layout_constraintVertical_bias="0.04000002" />
<TextView
android:id="#+id/tv_heading_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:gravity="center"
android:paddingStart="#dimen/big_margin"
android:paddingEnd="#dimen/big_margin"
android:text="Login with Saini Communication and get more offers!"
android:textColor="#color/white"
android:textSize="30sp"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<EditText
android:id="#+id/et_email_or_phone"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/fab_margin"
android:layout_marginTop="#dimen/big_margin"
android:layout_marginEnd="#dimen/fab_margin"
android:background="#drawable/et_back"
android:drawableStart="#drawable/ic_phone_iphone_black_24dp"
android:drawablePadding="#dimen/fab_margin"
android:ems="10"
android:hint="#string/mobile"
android:inputType="phone"
android:paddingStart="#dimen/normal_padding"
android:paddingTop="#dimen/medium_padding"
android:paddingEnd="#dimen/normal_padding"
android:paddingBottom="#dimen/medium_padding"
android:textColor="#color/white"
android:textColorHint="#color/whiteLight"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="parent" />
<EditText
android:id="#+id/et_password_la"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/fab_margin"
android:layout_marginTop="#dimen/big_margin"
android:layout_marginEnd="#dimen/fab_margin"
android:background="#drawable/et_back"
android:drawableStart="#drawable/ic_lock_black_24dp"
android:drawablePadding="#dimen/fab_margin"
android:ems="10"
android:hint="#string/prompt_password"
android:inputType="textPassword"
android:paddingStart="#dimen/normal_padding"
android:paddingTop="#dimen/medium_padding"
android:paddingEnd="#dimen/normal_padding"
android:paddingBottom="#dimen/medium_padding"
android:textColor="#color/white"
android:textColorHint="#color/whiteLight"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/et_email_or_phone" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.constraint.ConstraintLayout>
activity_login_detial.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/root_lay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:context=".activity.LoginActivity">
<android.support.v4.widget.NestedScrollView
android:id="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="8dp">
<!-- Login progress -->
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/root_lay_la"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:gravity="center"
android:orientation="vertical"
tools:context=".activity.LoginActivity">
<ImageView
android:id="#+id/iv_login_back"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.26999998"
app:srcCompat="#drawable/nature" />
<ProgressBar
android:id="#+id/pb_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tv_login_heading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:gravity="center"
android:paddingStart="#dimen/fab_margin"
android:paddingTop="#dimen/small_padding"
android:paddingEnd="#dimen/fab_margin"
android:paddingBottom="#dimen/small_padding"
android:text="Login Heading"
android:textColor="#color/white"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/btn_sign_in_la"
android:layout_width="0dp"
android:layout_height="#dimen/button_size"
android:layout_gravity="center_horizontal"
android:layout_marginStart="#dimen/fab_margin"
android:layout_marginTop="32dp"
android:layout_marginEnd="#dimen/fab_margin"
android:layout_marginBottom="8dp"
android:background="#drawable/login_btn_back"
android:paddingStart="#dimen/button_padding"
android:paddingTop="#dimen/normal_padding"
android:paddingEnd="#dimen/button_padding"
android:paddingBottom="#dimen/normal_padding"
android:text="#string/sign_in"
android:textAllCaps="false"
android:textColor="#color/primaryDark"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="#+id/iv_login_back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/et_password_la"
app:layout_constraintVertical_bias="0.04000002" />
<TextView
android:id="#+id/tv_heading_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:gravity="center"
android:paddingStart="#dimen/big_margin"
android:paddingEnd="#dimen/big_margin"
android:text="Login with Saini Communication and get more offers!"
android:textColor="#color/white"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_login_heading" />
<EditText
android:id="#+id/et_email_or_phone"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/fab_margin"
android:layout_marginTop="#dimen/big_margin"
android:layout_marginEnd="#dimen/fab_margin"
android:background="#drawable/et_back"
android:drawableStart="#drawable/ic_phone_iphone_black_24dp"
android:drawablePadding="#dimen/fab_margin"
android:ems="10"
android:hint="#string/mobile"
android:inputType="phone"
android:paddingStart="#dimen/normal_padding"
android:paddingTop="#dimen/medium_padding"
android:paddingEnd="#dimen/normal_padding"
android:paddingBottom="#dimen/medium_padding"
android:textColor="#color/white"
android:textColorHint="#color/whiteLight"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_heading_login" />
<EditText
android:id="#+id/et_password_la"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/fab_margin"
android:layout_marginTop="#dimen/big_margin"
android:layout_marginEnd="#dimen/fab_margin"
android:background="#drawable/et_back"
android:drawableStart="#drawable/ic_lock_black_24dp"
android:drawablePadding="#dimen/fab_margin"
android:ems="10"
android:hint="#string/prompt_password"
android:inputType="textPassword"
android:paddingStart="#dimen/normal_padding"
android:paddingTop="#dimen/medium_padding"
android:paddingEnd="#dimen/normal_padding"
android:paddingBottom="#dimen/medium_padding"
android:textColor="#color/white"
android:textColorHint="#color/whiteLight"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/et_email_or_phone" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.constraint.ConstraintLayout>
LoginActivity.java
#BindView(R.id.root_lay_la)
ConstraintLayout animLay;
public void show(){
show=true;
ConstraintSet constraintSet=new ConstraintSet();
constraintSet.clone(this,R.layout.activity_login_detail);
android.support.transition.Transition transition=new android.support.transition.ChangeBounds();
AnticipateOvershootInterpolator interpolator=new AnticipateOvershootInterpolator(1.5f);
transition.setInterpolator(interpolator);
transition.setDuration(1500);
android.support.transition.TransitionManager.beginDelayedTransition(animLay,transition);
constraintSet.applyTo(animLay);
}
public void hide(){
show =false;
ConstraintSet constraintSet=new ConstraintSet();
constraintSet.clone(this,R.layout.activity_login);
android.support.transition.Transition transition=new android.support.transition.ChangeBounds();
AnticipateOvershootInterpolator interpolator=new AnticipateOvershootInterpolator(1.5f);
transition.setInterpolator(interpolator);
transition.setDuration(1500);
android.support.transition.TransitionManager.beginDelayedTransition(animLay,transition);
constraintSet.applyTo(animLay);
}