Reputation: 373
My layout has a constraint layout as a root element.
There is the issue of responsiveness in the forgot password section as a view.
Following is the code snippet that has an error in responsive.
Please Suggest me.
This chunk of code is for password edit text view and forgot password view
//TextInputLayout for password visibility
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_20sdp"
android:layout_marginTop="@dimen/_40sdp"
android:layout_marginEnd="@dimen/_80sdp"
android:background="@drawable/shapelogin"
app:hintEnabled="false"
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="@+id/backgroundImage"
app:layout_constraintVertical_bias="0.573"
app:passwordToggleEnabled="true"
tools:ignore="MissingConstraints">
//edit textfield
<EditText
android:id="@+id/epassword"
style="@style/activity_font_edit_field_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shapelogin"
android:drawableStart="@drawable/ic_icon_password"
android:drawablePadding="@dimen/_20sdp"
android:hint="@string/prompt_password"
android:inputType="textPassword"
android:paddingLeft="@dimen/activity_start_padding"
android:singleLine="true"
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="@+id/backgroundImage"
app:layout_constraintVertical_bias="0.573" />
</com.google.android.material.textfield.TextInputLayout>
//forgot password imageview
<ImageView
android:id="@+id/imageView7"
android:layout_width="@dimen/_68sdp"
android:layout_height="@dimen/_40sdp"
android:background="@drawable/shapelogin"
app:layout_constraintBottom_toBottomOf="@+id/textInput"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.91"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/textInput"
app:layout_constraintVertical_bias="0.573" />
//forgot text inside button
<TextView
android:id="@+id/textViewForget"
style="@style/activity_font_forgot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/password_forgot"
android:background="@drawable/shapelogin"
android:textColor="@color/linkColor"
app:layout_constraintBottom_toBottomOf="@+id/textInput"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.891"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/textInput"
app:layout_constraintVertical_bias="0.516" />
Upvotes: 1
Views: 106
Reputation: 1379
You need to change the layout height for your view textViewForget
.
Instead of wrap_content
make it 0dp
which will be treated as MATCH_CONSTRAINT
that indicates the view should fill up all available space specified wrt top and bottom constraints (in this case your edit text view)
Also in your layout there seems to be arbitrary horizontal/vertical bias set, you might want to check for correctness in the layout preview with different screen sizes.
Please refer to the documentation for more info - https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayout#DimensionConstraints
Upvotes: 1