How do I pass entries from xml to kt? - android

I volunteer with an organization that provides no-cost labor to build wheelchair ramps, wrapiowa.org
One of our volunteers did an app for Apple phones to assist in this activity. I am attempting to duplicate his work for Android using Android Studio but need help. My expertise is in wood designing and construction, not app programming.
Thanks, Ron
Here is what I have, two user inputs for length in inches and 16th’s and height in inches and 16th’s.
Input variables: edittext_number_length, edittext_number16_length, edittext_number_height, edittext_number16_height
The output I want is an angle in degrees and a run length:
Output variables: textView_cut_angle, textView_run
Based on this math:
Math:
length = edittext_number_length + (edittext_number16_length/16)
height = edittext_number_height + (edittext_number16_height/16)
textView_cut_angle = (asin(height/lenght)*180/3.1416)
textView_run = (sqrt(pow(length, 2) - pow(height,2)))
angle.kt
package com.example.wrap_iowarampdesignaid
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
class angle : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_angle)
}
fun launchAngleActivity(view: View) {
startActivity(Intent(this#angle,illustration::class.java))
}
fun launchUpdateActivity(view: View) {
}
}
activity_angle.xml
<?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="#android:color/black"
tools:context=".angle">
<ImageView
android:id="#+id/logo"
android:layout_width="218dp"
android:layout_height="100dp"
android:layout_marginTop="16dp"
android:contentDescription="#string/logo"
android:scaleType="centerInside"
android:src="#drawable/logo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/string2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="#string/angle2"
android:textColor="#android:color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/logo" />
<Button
android:id="#+id/angle_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="launchAngleActivity"
android:text="#string/s_illustration"
android:textAllCaps="false"
android:textColor="#android:color/white"
app:backgroundTint="#2196F3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="#+id/update_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:onClick="launchUpdateActivity"
android:text="#string/Update"
android:textAllCaps="false"
android:textColor="#android:color/white"
app:backgroundTint="#2196F3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView18" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:text="#string/s_length"
android:textColor="#android:color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/string2" />
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:text="#string/s_heigth"
android:textColor="#android:color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView7" />
<TextView
android:id="#+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:text="#string/sc_angle"
android:textColor="#android:color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/update_button" />
<TextView
android:id="#+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:text="#string/sc_length"
android:textColor="#android:color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView19" />
<TextView
android:id="#+id/textView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:text="#string/degrees"
android:textColor="#android:color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/textView19" />
<TextView
android:id="#+id/textView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:text="#string/inches"
android:textColor="#android:color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/textView20" />
<EditText
android:id="#+id/edittext_number_length"
android:layout_width="40dp"
android:layout_height="0dp"
android:layout_marginEnd="16dp"
android:background="#color/white"
android:inputType="number"
app:layout_constraintBottom_toBottomOf="#+id/textView7"
app:layout_constraintEnd_toStartOf="#+id/edittext_number16_length"
app:layout_constraintTop_toTopOf="#+id/textView7" />
<EditText
android:id="#+id/edittext_number16_length"
android:layout_width="25dp"
android:layout_height="0dp"
android:background="#color/white"
android:inputType="number"
app:layout_constraintBottom_toBottomOf="#+id/textView7"
app:layout_constraintEnd_toStartOf="#+id/textView_number_length"
app:layout_constraintTop_toTopOf="#+id/textView7" />
<EditText
android:id="#+id/edittext_number_height"
android:layout_width="40dp"
android:layout_height="0dp"
android:layout_marginEnd="16dp"
android:background="#color/white"
android:inputType="number"
app:layout_constraintBottom_toBottomOf="#+id/textView18"
app:layout_constraintEnd_toStartOf="#+id/edittext_number16_height"
app:layout_constraintTop_toTopOf="#+id/textView18" />
<EditText
android:id="#+id/edittext_number16_height"
android:layout_width="25dp"
android:layout_height="0dp"
android:background="#color/white"
android:inputType="number"
app:layout_constraintBottom_toBottomOf="#+id/textView18"
app:layout_constraintEnd_toStartOf="#+id/textView_number16_length"
app:layout_constraintTop_toTopOf="#+id/textView18"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="#+id/textView_number_length"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:background="#color/white"
android:text="#string/_16"
app:layout_constraintBottom_toBottomOf="#+id/textView7"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/textView7" />
<TextView
android:id="#+id/textView_number16_length"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:background="#color/white"
android:text="#string/_16"
app:layout_constraintBottom_toBottomOf="#+id/textView18"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/textView18" />
<TextView
android:id="#+id/textView_cut_angle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:background="#color/white"
android:text="0"
app:layout_constraintBottom_toBottomOf="#+id/textView19"
app:layout_constraintEnd_toStartOf="#+id/textView21"
app:layout_constraintTop_toTopOf="#+id/textView19" />
<TextView
android:id="#+id/textView_run"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:background="#color/white"
android:text="0"
app:layout_constraintBottom_toBottomOf="#+id/textView20"
app:layout_constraintEnd_toStartOf="#+id/textView22"
app:layout_constraintTop_toTopOf="#+id/textView20" />
</androidx.constraintlayout.widget.ConstraintLayout>

Related

Recyclerview layout in dialog box

I am facing a problem while opening recyclerview in a dialog box. The layout in the recyclerview is overlapping and cutting when I open this in a dialog box same like this:
But, my original layout is look like this:
and here is the code for my layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginBottom="14dp"
android:elevation="10dp"
android:padding="8dp"
app:cardCornerRadius="8dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/corner_layout"
android:paddingTop="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/r_field_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Admission No."
android:textColor="#009EBB"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="#+id/r_d_field_name"
app:layout_constraintStart_toStartOf="#+id/r_d_field_name"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="RtlHardcoded" />
<TextView
android:id="#+id/admission_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="45654"
android:textColor="#555555"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="#+id/st_name"
app:layout_constraintStart_toStartOf="#+id/st_name"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/r_d_field_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Student Name"
android:textColor="#009EBB"
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toTopOf="#+id/p_a_field_name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/r_field_name"
tools:ignore="RtlHardcoded" />
<TextView
android:id="#+id/st_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="Harikant Sharma"
android:textColor="#555555"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="#+id/st_father_mother_name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/r_d_field_name"
app:layout_constraintTop_toBottomOf="#+id/admission_no" />
<TextView
android:id="#+id/p_a_field_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Parents Name"
android:textColor="#009EBB"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="#+id/btn_call_st"
app:layout_constraintStart_toStartOf="#+id/r_d_field_name"
app:layout_constraintTop_toBottomOf="#+id/r_d_field_name"
tools:ignore="RtlHardcoded" />
<TextView
android:id="#+id/st_father_mother_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Suresh Kumar Sharma"
android:textColor="#555555"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="#+id/btn_view_st_profile"
app:layout_constraintStart_toStartOf="#+id/st_name"
app:layout_constraintTop_toBottomOf="#+id/st_name" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/btn_view_st_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="100dp"
android:layout_marginBottom="12dp"
android:gravity="center"
android:src="#drawable/view"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/btn_call_st"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.9"
app:tint="#color/white" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/btn_call_st"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:backgroundTint="#E10751"
android:gravity="center"
android:src="#drawable/phone"
app:layout_constraintBottom_toBottomOf="#+id/btn_view_st_profile"
app:layout_constraintEnd_toStartOf="#+id/btn_view_st_profile"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/btn_view_st_profile"
app:tint="#color/white" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
If you constrain both left and right, you need to set width=0dp
<TextView
android:id="#+id/st_name"
android:layout_width="0dp" <-- change to 0dp
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="Harikant Sharma"
android:textColor="#555555"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="#+id/st_father_mother_name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/r_d_field_name"
app:layout_constraintTop_toBottomOf="#+id/admission_no" />

Unable to find symbol error when adding a new view to xml

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?

how can i put an image out of the dialog [duplicate]

This question already has answers here:
View outside a Dialogs bounds
(4 answers)
Closed 2 years ago.
i want to put an image in top of a dialog with half out of the dialog and half inside the dialog as shown in this image
i try to do it using constraint layout but it shows like these
can any one help me to know how to make the image look like it out side the dialog as shown in the first image??
here is my code
<?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="450dp">
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="328dp"
android:src="#drawable/ic_done"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="35dp"
android:layout_marginStart="20dp"
android:layout_marginTop="36dp"
android:text="لحجز الخدمة قم بادخال رقم المريض"
android:textSize="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="72dp"
android:layout_marginEnd="24dp"
android:text="رقم المريض : "
android:textSize="30dp"
app:layout_constraintBottom_toTopOf="#+id/cancel_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#+id/editText_pation_number"
app:layout_constraintTop_toBottomOf="#+id/textView" />
<EditText
android:id="#+id/editText_pation_number"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:inputType="number"
android:layout_marginTop="72dp"
android:layout_marginEnd="204dp"
app:layout_constraintBottom_toTopOf="#+id/order_button"
app:layout_constraintEnd_toEndOf="#+id/textView2"
app:layout_constraintHorizontal_bias="0.99"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="#+id/cancel_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="48dp"
android:layout_marginEnd="96dp"
android:text="الغاء"
android:textSize="35dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView2"
app:layout_constraintVertical_bias="0.264" />
<Button
android:id="#+id/order_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="124dp"
android:layout_marginEnd="160dp"
android:layout_marginBottom="0dp"
android:background="#drawable/my_button"
android:shadowColor="#color/colorPrimaryDark"
android:text="حجز"
android:textColorHighlight="#color/white"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="#+id/cancel_text"
app:layout_constraintHorizontal_bias="0.844"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/editText_pation_number"
app:layout_constraintVertical_bias="0.723" />
</androidx.constraintlayout.widget.ConstraintLayout>
Since you are using your own layout for dialog, you can make these changes below for getting full result.
<?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="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="28dp"
android:layout_marginEnd="28dp">
<ImageView
android:id="#+id/imageView"
android:layout_width="140dp"
android:layout_height="140dp"
android:src="#android:drawable/btn_star"
android:translationZ="50dp"
app:layout_constraintBottom_toTopOf="#id/box_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/box_view" />
<androidx.cardview.widget.CardView
android:id="#+id/box_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/customer_found_layout_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="80dp"
android:visibility="invisible"
tools:visibility="visible">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="36dp"
android:layout_marginEnd="35dp"
android:text="لحجز الخدمة قم بادخال رقم المريض"
android:textSize="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="72dp"
android:layout_marginEnd="24dp"
android:text="رقم المريض : "
android:textSize="30dp"
app:layout_constraintBottom_toTopOf="#+id/cancel_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#+id/editText_pation_number"
app:layout_constraintTop_toBottomOf="#+id/textView" />
<EditText
android:id="#+id/editText_pation_number"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginTop="72dp"
android:layout_marginEnd="204dp"
android:inputType="number"
app:layout_constraintBottom_toTopOf="#+id/order_button"
app:layout_constraintEnd_toEndOf="#+id/textView2"
app:layout_constraintHorizontal_bias="0.99"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="#+id/cancel_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="48dp"
android:layout_marginEnd="96dp"
android:text="الغاء"
android:textSize="35dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView2"
app:layout_constraintVertical_bias="0.264" />
<Button
android:id="#+id/order_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="124dp"
android:layout_marginEnd="160dp"
android:layout_marginBottom="0dp"
android:background="#color/colorPrimary"
android:shadowColor="#color/colorPrimaryDark"
android:text="حجز"
android:textColorHighlight="#000000"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="#+id/cancel_text"
app:layout_constraintHorizontal_bias="0.844"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/editText_pation_number"
app:layout_constraintVertical_bias="0.723" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
What i did is removed imageView from it's parent and wrapped in into new parent making sibling of CardView.
I have changed backgrounds and colors, you undo those as required.
i found what i was looking forward here
i changed my code as rajasekhar suggested to me
my code went like these
<?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="wrap_content"
android:layout_gravity="center"
android:background="#color/transparent"
android:layout_marginStart="28dp"
android:layout_marginEnd="28dp">
<ImageView
android:id="#+id/imageView"
android:layout_width="140dp"
android:layout_height="140dp"
android:src="#drawable/ic_done"
android:translationZ="50dp"
android:background="#color/transparent"
app:layout_constraintBottom_toTopOf="#id/box_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/box_view" />
<androidx.cardview.widget.CardView
android:id="#+id/box_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/customer_found_layout_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="80dp"
tools:visibility="visible">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="36dp"
android:layout_marginEnd="35dp"
android:text="لحجز الخدمة قم بادخال رقم المريض"
android:textSize="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="72dp"
android:layout_marginEnd="24dp"
android:text="رقم المريض : "
android:textSize="30dp"
app:layout_constraintBottom_toTopOf="#+id/cancel_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#+id/editText_pation_number"
app:layout_constraintTop_toBottomOf="#+id/textView" />
<EditText
android:id="#+id/editText_pation_number"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginTop="72dp"
android:layout_marginEnd="204dp"
android:inputType="number"
app:layout_constraintBottom_toTopOf="#+id/order_button"
app:layout_constraintEnd_toEndOf="#+id/textView2"
app:layout_constraintHorizontal_bias="0.99"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="#+id/cancel_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="48dp"
android:layout_marginEnd="96dp"
android:text="الغاء"
android:textSize="35dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView2"
app:layout_constraintVertical_bias="0.264" />
<Button
android:id="#+id/order_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="124dp"
android:layout_marginEnd="160dp"
android:layout_marginBottom="0dp"
android:background="#color/colorPrimary"
android:shadowColor="#color/colorPrimaryDark"
android:text="حجز"
android:textColorHighlight="#000000"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="#+id/cancel_text"
app:layout_constraintHorizontal_bias="0.844"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/editText_pation_number"
app:layout_constraintVertical_bias="0.723" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
but these is not been what i want but as mhp said here
i added one line to my java code
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
and now it;s worked as i wanted

Android - Put ellipsis if there's collision between Text Views

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"

How to show different xml layout with different component and ids in one constraintLayout with constraintSet in android

I have a fragment that I need show and gone some XML layout into that with some steps (in this example I have 3 steps) I know simply we can include layout into parent fragment layout and just handle visible/gone layout. but I want to do it with ConstraintSet in ConstraintLayout. as I search for load another XML layout into parent XML layout both root elements in each XML layout must be constraint layout with the same component and same ids. but in my example, I have different XML layout with root element constraint layout but in each XML layout, I have different components and ids. now my question is how I can change part of my XML layout according to the step live data with another XML layout?
we care about be smooth this layout and change layout with some animation. these are my files:
PickupFragment:
class PickupFragment : BaseFragment<FragmentPickupBinding, PickupViewModel>
(R.layout.fragment_pickup, PickupViewModel()) {
private val primaryConstraintBody = ConstraintSet()
private val parcelConstraintBody = ConstraintSet()
private val senderConstraintBody = ConstraintSet()
private val receiverConstraintBody = ConstraintSet()
private val body by lazy { binding.body }
private val pickupRequestStepObserver = Observer<Int> { step ->
when (step) {
0 -> parcelConstraintBody.loading(body)
1 -> senderConstraintBody.loading(body)
2 -> receiverConstraintBody.loading(body)
}
}
override fun initVariables() {
binding.viewModel = vModel
}
override fun initObserves() {
vModel.pickupRequestStep.observe(this, pickupRequestStepObserver)
}
override fun initViews() {
vModel.pickupRequestStep.value = 0
primaryConstraintBody.clone(body)
parcelConstraintBody.clone(context, R.layout.fragment_pickup_parcel)
senderConstraintBody.clone(context, R.layout.fragment_pickup_sender)
receiverConstraintBody.clone(context, R.layout.fragment_pickup_receiver)
}
}
fragment_pickup:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="com.chaparnet.chapar.views.pickup.PickupViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/body">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/constraintBody"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
fragment_pickup_parcel:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewModel"
type="com.chaparnet.chapar.views.pickup.PickupViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/constraintBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".delivery_pickup.AddCargoFragment">
<TextView
android:id="#+id/txt_text_add_pickup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginRight="16dp"
android:fontFamily="#font/main_bold"
android:text=" "
android:textColor="#color/colorPrimary"
android:textSize="18sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/txt_text_new_pickup_waybill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginRight="16dp"
android:fontFamily="#font/main_medium"
android:text=""
android:textColor="#color/lightGray"
android:textSize="14sp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/txt_text_add_pickup" />
<EditText
android:id="#+id/et_new_pickup_waybill"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="24dp"
android:layout_marginRight="8dp"
android:background="#android:color/transparent"
android:fontFamily="#font/main_medium"
android:gravity="right"
android:inputType="number"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="100dp"
android:paddingBottom="16dp"
android:textColor="#color/darkGray"
android:textSize="14sp"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/txt_text_add_pickup" />
<View
android:id="#+id/view_waybill"
android:layout_width="match_parent"
android:layout_height="#dimen/divider_height"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#color/lighterGray"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/et_new_pickup_waybill" />
<TextView
android:id="#+id/txt_text_new_pickup_closed_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"
android:fontFamily="#font/main_medium"
android:text=" "
android:textColor="#color/lightGray"
android:textSize="14sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_waybill" />
<EditText
android:id="#+id/et_new_pickup_closed_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:background="#android:color/transparent"
android:fontFamily="#font/main_medium"
android:gravity="right"
android:inputType="number"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="100dp"
android:paddingBottom="16dp"
android:text="#={viewModel.pickupClosedCount}"
android:textColor="#color/darkGray"
android:textSize="14sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_waybill" />
<View
android:id="#+id/view_closed_count"
android:layout_width="match_parent"
android:layout_height="#dimen/divider_height"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#color/lighterGray"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/et_new_pickup_closed_count" />
<TextView
android:id="#+id/txt_text_new_pickup_kind_service"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"
android:fontFamily="#font/main_medium"
android:text=" "
android:textColor="#color/lightGray"
android:textSize="14sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_closed_count" />
<Spinner
android:id="#+id/spinner_new_pickup_kind_service"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="14dp"
android:layout_marginRight="100dp"
android:paddingLeft="16dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_closed_count" />
<View
android:id="#+id/view_kind_service"
android:layout_width="match_parent"
android:layout_height="#dimen/divider_height"
android:layout_marginLeft="20dp"
android:layout_marginTop="16dp"
android:layout_marginRight="20dp"
android:background="#color/lighterGray"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/txt_text_new_pickup_kind_service" />
<TextView
android:id="#+id/txt_text_new_pickup_kind_rent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"
android:fontFamily="#font/main_medium"
android:text=""
android:textColor="#color/lightGray"
android:textSize="14sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_kind_service" />
<!--<androidx.appcompat.widget.AppCompatSpinner
android:id="#+id/spinner_new_pickup_kind_rent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:layout_marginRight="100dp"
android:paddingLeft="16dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_kind_service" />-->
<RadioGroup
android:id="#+id/spinner_new_pickup_kind_rent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="10dp"
android:layout_marginRight="100dp"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="16dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_kind_service">
<RadioButton
android:id="#+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginRight="16dp"
android:button="#null"
android:checked="#={viewModel.radioPasPayment}"
android:drawableRight="?android:attr/listChoiceIndicatorSingle"
android:fontFamily="#font/main_light"
android:layoutDirection="rtl"
android:text=""
android:textAlignment="textStart"
android:textSize="12sp" />
<RadioButton
android:id="#+id/radio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:button="#null"
android:checked="#={viewModel.radioPishPayment}"
android:drawableRight="?android:attr/listChoiceIndicatorSingle"
android:fontFamily="#font/main_light"
android:layoutDirection="rtl"
android:text=""
android:textAlignment="textStart"
android:textSize="12sp" />
</RadioGroup>
<View
android:id="#+id/view_kind_rent"
android:layout_width="match_parent"
android:layout_height="#dimen/divider_height"
android:layout_marginLeft="20dp"
android:layout_marginTop="16dp"
android:layout_marginRight="20dp"
android:background="#color/lighterGray"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/txt_text_new_pickup_kind_rent" />
<!--<TextView
android:id="#+id/txt_text_new_service_percentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"
android:fontFamily="#font/main_medium"
android:tag="check_for_visibility"
android:text="Service percent"
android:textColor="#color/lightGray"
android:textSize="14sp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_kind_rent" />
<EditText
android:id="#+id/et_new_pickup_service_percentage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:background="#android:color/transparent"
android:fontFamily="#font/main_medium"
android:gravity="right"
android:inputType="number"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="100dp"
android:paddingBottom="16dp"
android:tag="check_for_visibility"
android:textColor="#color/darkGray"
android:textSize="14sp"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_kind_rent" />
<View
android:id="#+id/view_kind_service_percentage"
android:layout_width="match_parent"
android:layout_height="#dimen/divider_height"
android:layout_marginLeft="20dp"
android:layout_marginTop="16dp"
android:layout_marginRight="20dp"
android:background="#color/lighterGray"
android:tag="check_for_visibility"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/txt_text_new_service_percentage" />-->
<TextView
android:id="#+id/txt_text_new_weight_of_goods"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"
android:fontFamily="#font/main_medium"
android:tag="check_for_visibility"
android:text="weight"
android:textColor="#color/lightGray"
android:textSize="14sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_kind_rent" />
<EditText
android:id="#+id/et_new_pickup_weight_of_goods"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:background="#android:color/transparent"
android:fontFamily="#font/main_medium"
android:gravity="right"
android:inputType="number"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="100dp"
android:paddingBottom="16dp"
android:tag="check_for_visibility"
android:text="#={viewModel.weightOfGoods}"
android:textColor="#color/darkGray"
android:textSize="14sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_kind_rent" />
<View
android:id="#+id/view_weight_of_goods"
android:layout_width="match_parent"
android:layout_height="#dimen/divider_height"
android:layout_marginLeft="20dp"
android:layout_marginTop="16dp"
android:layout_marginRight="20dp"
android:background="#color/lighterGray"
android:tag="check_for_visibility"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/txt_text_new_weight_of_goods" />
<TextView
android:id="#+id/txt_text_new_value_of_goods"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"
android:fontFamily="#font/main_medium"
android:tag="check_for_visibility"
android:text="Value"
android:textColor="#color/lightGray"
android:textSize="14sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_weight_of_goods" />
<EditText
android:id="#+id/et_new_pickup_value_of_goods"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:background="#android:color/transparent"
android:fontFamily="#font/main_medium"
android:gravity="right"
android:inputType="number"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="100dp"
android:paddingBottom="16dp"
android:tag="check_for_visibility"
android:text="#={viewModel.valueOfGoods}"
android:textColor="#color/darkGray"
android:textSize="14sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/view_weight_of_goods" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
and two other fragments are like fragment_pickup_sender and fragment_pickup_receiver but with different components and ids. in my fragment_pickup I'll have some button with next step and the previous step for update step live data to switch XML layout.
may please guide me on how I must handle this

Categories

Resources