I have a Frame layout and an image in said layout, now I want to outline the image in the layout, but when I try to set the background of the ImageView, it just ignores it and fits the canvas, it works in the layoutEditor but for some reason not in the actual app, one thing that I think might be important to know is that the image in the imageview is set by the user so I can't just use an already outlined image.
Thanks in advance for any help.
//Edit
layout-file-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="match_parent"
android:background="#000000"
tools:context=".stickerview.EditActivity">
<ImageView
android:id="#+id/COPYRIGHT"
android:layout_width="108dp"
android:layout_height="122dp"
android:layout_marginStart="101dp"
android:layout_marginEnd="151dp"
android:layout_marginBottom="518dp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.509"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.751"
app:srcCompat="#drawable/COPYRIGHT_best" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/canvas"
android:layout_width="319dp"
android:layout_height="342dp"
android:background="#drawable/image"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="#+id/saveBtn"
app:layout_constraintEnd_toEndOf="#+id/cropBtn"
app:layout_constraintHorizontal_bias="0.333"
app:layout_constraintStart_toStartOf="#+id/shareBtn"
app:layout_constraintTop_toTopOf="#+id/COPYRIGHT"
app:layout_constraintVertical_bias="1.0"
tools:visibility="visible">
<ImageView
android:id="#+id/editPresetEdit"
android:layout_width="318dp"
android:layout_height="343dp"
android:background="#drawable/outline"
android:scaleType="fitXY"
android:visibility="visible"
app:srcCompat="#drawable/backbtn"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
<Button
android:id="#+id/backBtn"
android:layout_width="53dp"
android:layout_height="44dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="713dp"
android:background="#drawable/backbtn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<ImageView
android:id="#+id/buttonBar"
android:layout_width="333dp"
android:layout_height="101dp"
android:layout_marginStart="36dp"
android:layout_marginTop="477dp"
android:layout_marginEnd="34dp"
android:layout_marginBottom="82dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/buttonbar" />
<Button
android:id="#+id/cropBtn"
android:layout_width="60dp"
android:layout_height="79dp"
android:layout_marginStart="304dp"
android:layout_marginTop="485dp"
android:layout_marginEnd="44dp"
android:layout_marginBottom="95dp"
android:background="#drawable/cropbtn"
android:text="#string/crop_picture"
android:textSize="10sp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/COPYRIGHTBtn"
android:layout_width="51dp"
android:layout_height="79dp"
android:layout_marginStart="255dp"
android:layout_marginTop="485dp"
android:layout_marginEnd="105dp"
android:layout_marginBottom="95dp"
android:background="#drawable/textbtn"
android:text="COPYRIGHT"
android:textSize="10sp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/saveBtn"
android:layout_width="105dp"
android:layout_height="79dp"
android:layout_marginStart="151dp"
android:layout_marginTop="485dp"
android:layout_marginEnd="155dp"
android:layout_marginBottom="95dp"
android:background="#drawable/textbtn"
android:text="#string/save"
android:textSize="19sp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/textStickerBtn"
android:layout_width="55dp"
android:layout_height="79dp"
android:layout_marginStart="97dp"
android:layout_marginTop="485dp"
android:layout_marginEnd="259dp"
android:layout_marginBottom="95dp"
android:background="#drawable/textbtn"
android:text="#string/text"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/shareBtn"
android:layout_width="52dp"
android:layout_height="79dp"
android:layout_marginStart="45dp"
android:layout_marginTop="485dp"
android:layout_marginEnd="314dp"
android:layout_marginBottom="95dp"
android:background="#drawable/sharebtn"
android:text="#string/share"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/head"
android:layout_width="445dp"
android:layout_height="222dp"
android:layout_marginStart="4dp"
android:layout_marginBottom="64dp"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="#+id/button"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="#drawable/head"
tools:visibility="visible" />
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="336dp"
android:layout_marginTop="260dp"
android:text="NiggaButtonV2"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.483"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
and here is the layout I want
layout
Instead of
app:srcCompat="#drawable/COPYRIGHT_best"
Use
android:src="#drawable/COPYRIGHT_best"
Related
I'm trying to implement a proper snackbar that doesn't overlap other views, to do that I added to the activity a Coordinator Layout and inside I placed a constraint layout with the views I want to be pushed up. In the constraint layout I set the attribute app:layout_dodgeInsetEdges="bottom" but when the snackbar appears it pushes the views upwards but it is a little glitchy, here is the video:
video
The video is of an emulator but the same thing happens on real phones.
<?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=".login.LoginActivity">
<ImageView
android:id="#+id/login_logo"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_marginStart="80dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="80dp"
android:contentDescription="#string/logo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/google_logo" />
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="#+id/loginCoordinatorLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/login_outwire_logo">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/innerConstraintlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_dodgeInsetEdges="bottom">
<LinearLayout
android:id="#+id/create_account_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginBottom="16dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/facebook_sign_button">
<TextView
android:id="#+id/dont_have_account_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:text="#string/don_t_have_an_account"
android:textSize="#dimen/subTextSize" />
<TextView
android:id="#+id/create_account_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:text="#string/create_account"
android:textColor="#color/clickable_subtext_blue"
android:textSize="#dimen/subTextSize" />
</LinearLayout>
<EditText
android:id="#+id/login_user_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:autofillHints="Username, Email"
android:ems="14"
android:hint="#string/email_username"
android:inputType="text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="TextFields" />
<EditText
android:id="#+id/login_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autofillHints="Password"
android:ems="14"
android:hint="#string/password"
android:inputType="textPassword"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/login_user_email" />
<com.app.custom.views.SignInButton
android:id="#+id/sign_in_button"
android:layout_width="#dimen/sign_button_width"
android:layout_height="#dimen/sign_button_height"
android:layout_marginTop="48dp"
android:background="#drawable/sign_in_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/login_password"
app:text="#string/sign_in"
app:text_color="?attr/colorOnPrimary"
app:text_size="#dimen/sign_button_text" />
<TextView
android:id="#+id/forgot_password_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:clickable="true"
android:elevation="2dp"
android:focusable="true"
android:text="#string/forgot_your_password"
android:textColor="#color/clickable_subtext_blue"
android:textSize="#dimen/subTextSize"
app:layout_constraintEnd_toEndOf="#+id/login_password"
app:layout_constraintTop_toBottomOf="#+id/login_password" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/or_sign_in_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.6"
android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="#+id/google_sign_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/sign_in_button">
<View
android:id="#+id/separator"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#color/separator_grey"
android:contentDescription="#string/sign_in_options_separator"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/or_sign_in_with_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/or_sign_in_with_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/or_sign_in_with"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="#+id/separator2"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#color/separator_grey"
android:contentDescription="#string/sign_in_options_separator"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/or_sign_in_with_text"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.app.custom.views.SignInButton
android:id="#+id/google_sign_button"
android:layout_width="#dimen/sign_button_width"
android:layout_height="#dimen/sign_button_height"
android:layout_marginTop="64dp"
android:backgroundTint="?attr/colorSecondary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/sign_in_button"
app:src_logo="#drawable/google_logo"
app:text="#string/google"
app:text_color="?attr/colorOnSecondary" />
<com.app.custom.views.SignInButton
android:id="#+id/facebook_sign_button"
android:layout_width="#dimen/sign_button_width"
android:layout_height="#dimen/sign_button_height"
android:layout_marginTop="8dp"
android:backgroundTint="#color/facebook_blue"
android:clickable="true"
android:focusable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/google_sign_button"
app:src_logo="#drawable/fb_logo"
app:text="#string/facebook"
app:text_size="#dimen/sign_button_text"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
I have put Constraint layout inside a Nested Scrollview to make the screen scrollable, but it doesn't scroll.
This is my XML:
<?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_height="match_parent"
android:layout_width="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/clMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/dark_blue"
tools:context=".SignUpActivity"
>
<ImageView
android:id="#+id/ivLogo"
android:layout_width="#dimen/_148sdp"
android:layout_height="#dimen/_60sdp"
android:src="#drawable/logo_voodlee"
app:layout_constraintVertical_bias="0.08"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<TextView
android:id="#+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name as on Pan Card"
android:visibility="visible"
app:fontFamily="#font/poppins_regular"
android:textColor="#color/fade_green"
android:textSize="#dimen/_11ssp"
app:layout_constraintVertical_bias="0.285"
app:layout_constraintHorizontal_bias="0.135"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<EditText
android:id="#+id/etName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Name as on Pan Card"
android:gravity="left"
android:inputType="textVisiblePassword"
android:background="#drawable/bg_edittext_thin_line_bright_green"
android:layout_marginLeft="#dimen/_20sdp"
android:layout_marginRight="#dimen/_20sdp"
android:lineSpacingExtra="#dimen/_3sdp"
app:fontFamily="#font/poppins_regular"
android:textColor="#color/bright_green"
android:textColorHint="#color/fade_green"
android:textSize="#dimen/dimen_20dp"
android:importantForAutofill="no"
app:layout_constraintVertical_bias="0.31"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="#+id/tvEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Email"
android:visibility="visible"
app:fontFamily="#font/poppins_regular"
android:textColor="#color/fade_green"
android:textSize="#dimen/_11ssp"
app:layout_constraintVertical_bias="0.4"
app:layout_constraintHorizontal_bias="0.091"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<EditText
android:id="#+id/etEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textVisiblePassword"
android:hint="Email"
android:gravity="left"
android:background="#drawable/bg_edittext_thin_line_bright_green"
android:lineSpacingExtra="#dimen/_3sdp"
app:fontFamily="#font/poppins_regular"
android:layout_marginLeft="#dimen/_20sdp"
android:layout_marginRight="#dimen/_20sdp"
android:textColor="#color/bright_green"
android:textColorHint="#color/fade_green"
android:textSize="#dimen/dimen_20dp"
android:importantForAutofill="no"
app:layout_constraintVertical_bias="0.43"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="#+id/tvErrorMsgEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:text="* Please enter valid email address"
android:textSize="#dimen/_10ssp"
android:textColor="#color/voodlee_red"
app:fontFamily="#font/poppins_regular"
android:layout_marginTop="#dimen/_4sdp"
app:layout_constraintHorizontal_bias=".1375"
app:layout_constraintVertical_bias="0.47"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<TextView
android:id="#+id/tvMob"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile Number"
android:gravity="center_vertical"
android:visibility="visible"
app:fontFamily="#font/poppins_regular"
android:textColor="#color/fade_green"
android:textSize="#dimen/_11ssp"
app:layout_constraintVertical_bias="0.515"
app:layout_constraintHorizontal_bias="0.115"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<EditText
android:id="#+id/etMob"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone"
android:hint="Mobile Number"
android:gravity="left"
android:lineSpacingExtra="#dimen/_3sdp"
android:layout_marginLeft="#dimen/_20sdp"
android:layout_marginRight="#dimen/_20sdp"
android:textColor="#color/bright_green"
android:textColorHint="#color/fade_green"
android:textSize="#dimen/dimen_20dp"
app:fontFamily="#font/poppins_regular"
android:background="#drawable/bg_edittext_thin_line_bright_green"
android:importantForAutofill="no"
app:layout_constraintVertical_bias="0.55"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<TextView
android:id="#+id/tvErrorMsgMobile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:text="* Please enter valid mobile number"
android:textSize="#dimen/_10ssp"
android:textColor="#color/voodlee_red"
app:fontFamily="#font/poppins_regular"
android:layout_marginTop="#dimen/_4sdp"
app:layout_constraintHorizontal_bias=".135"
app:layout_constraintVertical_bias="0.5875"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<TextView
android:id="#+id/tvAgree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="By clicking Proceed you agree to"
android:textSize="#dimen/dimen_14dp"
android:textColor="#color/bright_green"
app:fontFamily="#font/poppins_regular"
android:gravity="center"
app:layout_constraintVertical_bias="0.6575"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<TextView
android:id="#+id/tvAgree2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="the"
android:textSize="#dimen/dimen_14dp"
android:textColor="#color/bright_green"
app:fontFamily="#font/poppins_regular"
android:gravity="center"
app:layout_constraintVertical_bias="0.0"
app:layout_constraintHorizontal_bias="0.125"
app:layout_constraintLeft_toLeftOf="#id/tvAgree"
app:layout_constraintRight_toRightOf="#id/tvAgree"
app:layout_constraintTop_toBottomOf="#id/tvAgree"
app:layout_constraintBottom_toBottomOf="parent"
/>
<TextView
android:id="#+id/tvTnc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Terms and conditions"
android:textColor="#color/text_highlight"
android:textSize="#dimen/dimen_14dp"
app:fontFamily="#font/poppins_regular"
app:layout_constraintVertical_bias="0.01"
app:layout_constraintHorizontal_bias="0.2"
app:layout_constraintLeft_toRightOf="#id/tvAgree2"
app:layout_constraintRight_toRightOf="#id/tvAgree"
app:layout_constraintTop_toBottomOf="#id/tvAgree"
app:layout_constraintBottom_toBottomOf="parent"
/>
<Button
android:id="#+id/btnNextSignUp"
android:layout_width="match_parent"
android:layout_height="#dimen/_36sdp"
android:background="#drawable/bg_btn_proceed_disabled"
android:layout_margin="#dimen/_25sdp"
android:text="Proceed"
android:textColor="#color/dark_blue"
android:textAllCaps="false"
android:textSize="#dimen/dimen_20dp"
android:onClick="onClickNext"
android:fontFamily="#font/poppins_semi_bold"
android:foreground="?attr/selectableItemBackground"
app:layout_constraintVertical_bias="0.825"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="#+id/tvAlreadyHave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/text_highlight"
android:text="Already have an account?"
app:fontFamily="#font/poppins_regular"
android:textSize="#dimen/_11sdp"
android:textStyle="bold"
app:layout_constraintVertical_bias="0.87"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<!--Code for Progressbar at bottom of screen-->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/clProgressSignUp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
app:layout_constraintVertical_bias="0.96"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
>
<ImageView
android:id="#+id/ivFlowLine"
android:layout_width="#dimen/_210sdp"
android:layout_height="wrap_content"
android:scaleType="fitXY"
app:layout_constraintVertical_bias=".425"
app:layout_constraintHorizontal_bias=".425"
android:src=
"#drawable/bg_flow_line_fade_green"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<ImageView
android:id="#+id/ivStartCircle"
android:layout_width="#dimen/_9sdp"
android:layout_height="#dimen/_9sdp"
android:src="#drawable/bg_flow_circle_bright_green"
app:layout_constraintRight_toLeftOf="#id/ivFlowLine"
app:layout_constraintTop_toTopOf="#id/ivFlowLine"
app:layout_constraintBottom_toBottomOf="#id/ivFlowLine"/>
<com.example.voodlee.GradualGrowingLine
android:id="#+id/ivOrangeLineSignUp"
android:layout_width="#dimen/_14sdp"
android:layout_height="#dimen/_3sdp"
app:startingPoint="0"
app:layout_constraintVertical_bias=".425"
app:layout_constraintLeft_toLeftOf="#id/ivStartCircle"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<ImageView
android:id="#+id/ivCircle2"
android:layout_width="#dimen/_16sdp"
android:layout_height="#dimen/_16sdp"
android:layout_marginLeft="#dimen/_22sdp"
app:layout_constraintVertical_bias=".4"
app:layout_constraintHorizontal_bias="0.43"
android:src=
"#drawable/bg_flow_circle_black"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<ImageView
android:id="#+id/ivCircle5"
android:layout_width="#dimen/_16sdp"
android:layout_height="#dimen/_16sdp"
app:layout_constraintVertical_bias=".4"
android:src=
"#drawable/bg_flow_circle_black"
app:layout_constraintHorizontal_bias="0.85"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="#+id/tvSignUp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SignUp"
android:textSize="#dimen/_9ssp"
android:textColor="#color/fade_green"
app:fontFamily="#font/poppins_regular"
app:layout_constraintLeft_toLeftOf="#id/ivCircle2"
app:layout_constraintRight_toRightOf="#id/ivCircle2"
app:layout_constraintTop_toBottomOf="#id/ivCircle2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Autosaving"
android:textSize="#dimen/_9sdp"
android:textColor="#color/fade_green"
app:fontFamily="#font/poppins_regular"
app:layout_constraintLeft_toLeftOf="#id/ivCircle5"
app:layout_constraintRight_toRightOf="#id/ivCircle5"
app:layout_constraintTop_toBottomOf="#id/ivCircle5"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/cl2ProgressSignUp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintVertical_bias="0.96"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
>
<ImageView
android:id="#+id/iv2FlowLine"
android:layout_width="#dimen/_210sdp"
android:layout_height="wrap_content"
android:scaleType="fitXY"
app:layout_constraintVertical_bias=".425"
app:layout_constraintHorizontal_bias=".425"
android:src=
"#drawable/bg_flow_line_fade_green"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<ImageView
android:id="#+id/iv2StartCircle"
android:layout_width="#dimen/_9sdp"
android:layout_height="#dimen/_9sdp"
android:src="#drawable/bg_flow_circle_bright_green"
app:layout_constraintRight_toLeftOf="#id/iv2FlowLine"
app:layout_constraintTop_toTopOf="#id/iv2FlowLine"
app:layout_constraintBottom_toBottomOf="#id/iv2FlowLine"/>
<ImageView
android:id="#+id/iv2OrangeLine"
android:layout_width="#dimen/_14sdp"
android:layout_height="#dimen/_3sdp"
app:layout_constraintVertical_bias="0.425"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:src=
"#drawable/bg_flow_line_green_2"
app:layout_constraintLeft_toLeftOf="#id/iv2StartCircle"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<com.example.voodlee.GradualGrowingLine
android:id="#+id/iv2OrangeLineSignUp"
android:layout_width="#dimen/_50sdp"
android:layout_height="#dimen/_3sdp"
app:startingPoint="14"
app:layout_constraintVertical_bias=".425"
app:layout_constraintLeft_toLeftOf="#id/iv2StartCircle"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<ImageView
android:id="#+id/iv2Circle2"
android:layout_width="#dimen/_16sdp"
android:layout_height="#dimen/_16sdp"
android:layout_marginLeft="#dimen/_22sdp"
app:layout_constraintVertical_bias=".4"
app:layout_constraintHorizontal_bias="0.43"
android:src=
"#drawable/bg_flow_circle_black"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<ImageView
android:id="#+id/iv2Circle5"
android:layout_width="#dimen/_16sdp"
android:layout_height="#dimen/_16sdp"
app:layout_constraintVertical_bias=".4"
android:src=
"#drawable/bg_flow_circle_black"
app:layout_constraintHorizontal_bias="0.85"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="#+id/tv2SignUp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
androidø:text="SignUp"
android:textSize="#dimen/_9ssp"
android:textColor="#color/fade_green"
app:fontFamily="#font/poppins_regular"
app:layout_constraintLeft_toLeftOf="#id/iv2Circle2"
app:layout_constraintRight_toRightOf="#id/iv2Circle2"
app:layout_constraintTop_toBottomOf="#id/iv2Circle2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Autosaving"
android:textSize="#dimen/_9sdp"
android:textColor="#color/fade_green"
app:fontFamily="#font/poppins_regular"
app:layout_constraintLeft_toLeftOf="#id/iv2Circle5"
app:layout_constraintRight_toRightOf="#id/iv2Circle5"
app:layout_constraintTop_toBottomOf="#id/iv2Circle5"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
To be sure if Constraint layout really scrolls with Scrollview/Nested Scrollview, I created a demo project with simple layout with Constraint layout within Scrollview, and it DID scroll.
But I'm not sure why my screen with above layout doesn't scroll. Please help me figure out the issue.
Solved it by removing android: fillViewPort = "true" attribute from NestedScrollview, and adding an empty view at the end of layout like this:
<View
android:id="#+id/view1"
android:layout_width="match_parent"
android:layout_height="#dimen/_20sdp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#id/clProgressSignUp"
/>
Pleas try below Structure for scrolling ConstraintLayout.
<LinearLayout>
<androidx.core.widget.NestedScrollView>
<androidx.constraintlayout.widget.ConstraintLayout>
......
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
<LinearLayout>
I have a problem with the line that appears under each card as shown in this picture. Is there any way to remove it, or is it not possible?
Also, how can I present each card with a different color for example (purple and yellow)?
This 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="match_parent"
tools:context=".benReqView">
<Button
android:id="#+id/button15"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="#drawable/chat2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.6"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.977" />
<Button
android:id="#+id/benReqback"
android:layout_width="25dp"
android:layout_height="22dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:background="#drawable/leftarrow"
app:layout_constraintBottom_toTopOf="#+id/signupDon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.021"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.073" />
<TextView
android:id="#+id/benReqEmpty"
android:layout_width="150dp"
android:layout_height="23dp"
android:layout_marginStart="20dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="20dp"
android:text=""
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.086" />
<ListView
android:id="#+id/benReqListView"
android:layout_width="401dp"
android:layout_height="539dp"
android:layout_marginBottom="2dp"
android:background="#fafafa"
app:layout_constraintBottom_toTopOf="#+id/imageView8"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
</ListView>
<TextView
android:id="#+id/textView23"
android:layout_width="136dp"
android:layout_height="24dp"
android:fontFamily="#font/tajawalmedium2"
android:text="حالة الطلبات"
android:textAlignment="center"
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.022" />
<ImageView
android:id="#+id/imageView8"
android:layout_width="414dp"
android:layout_height="60dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:srcCompat="#drawable/footer" />
<Button
android:id="#+id/benReqToprofile"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="#drawable/userr"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.82"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.977" />
<Button
android:id="#+id/benReqToHomeicon"
android:layout_width="37dp"
android:layout_height="37dp"
android:background="#drawable/home"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.17"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.988" />
<Button
android:id="#+id/benReq"
android:layout_width="39dp"
android:layout_height="40dp"
android:background="#drawable/request"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.38"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.981" />
</androidx.constraintlayout.widget.ConstraintLayout>
I suspect that the line you're talking about is the ListView's background appearing between your cards.
Try removing this line: android:background="#fafafa"
By the way, I suggest you to use a RecyclerView instead of ListView
You can remove the ListView's dividers by setting the divider's height to 0dp. Add the following lines to your ListView:
android:dividerHeight="0dp"
android:divider="#null"
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
I am using the drag and drop functionality in the layout editor to try and get 4 image buttons aligned in a kite shape. This is the layout I am trying to achieve, currently using ImageButton but I will change to the circular image view to suit the layout later.
Can anyone help me to achieve this. Please find my XML below:
<android.support.constraint.ConstraintLayout
android:id="#+id/ongoing_call_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="#dimen/activity_padding"
android:layout_below="#id/contact_number_tv"
android:layout_above="#id/calculator_layout">
<ImageButton
android:id="#+id/home_imgBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="120dp"
android:src="#android:drawable/btn_star"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="#+id/not_billable_imgBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="104dp"
android:src="#android:drawable/btn_star"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="#+id/billable_imgBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#android:drawable/btn_star"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#+id/not_billable_imgBtn"
tools:layout_editor_absoluteY="105dp" />
<ImageButton
android:id="#+id/decide_later_imgBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="120dp"
android:src="#android:drawable/btn_star"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</android.support.constraint.ConstraintLayout>
Try this buddy, and make your own adjustments.
<android.support.constraint.ConstraintLayout
android:id="#+id/ongoing_call_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="#dimen/activity_padding"
android:layout_below="#id/contact_number_tv"
android:layout_above="#id/calculator_layout">
<ImageButton
android:id="#+id/home_imgBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:src="#android:drawable/btn_star"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.32"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="#+id/not_billable_imgBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:src="#android:drawable/btn_star"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="#+id/billable_imgBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:src="#android:drawable/btn_star"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.66"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="#+id/decide_later_imgBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="60dp"
android:layout_marginBottom="24dp"
android:src="#android:drawable/btn_star"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/not_billable_imgBtn" />
</android.support.constraint.ConstraintLayout>
See the example image
But perhaps your real problem is that the constrainLayout is not your root element, and you should set a fixed height instead of android:layout_height="wrap_content"