0

On adding paddingleft to textinputlayout an equal number of spacing is applied to right hand side as if a margin is applied.

fragment_add_task.xml with left padding:

<com.google.android.material.textfield.TextInputLayout
    style="@style/TextInputLayout"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:paddingLeft="@dimen/fifteen_dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">
    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/editText"
        style="@style/RR_12"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Hiiiii"
        android:inputType="text"
        android:textColorHint="@color/lightGrayColor" />
</com.google.android.material.textfield.TextInputLayout>

Result screen : With padding

But when i remove that leftpadding it comes back to normal.

fragment_add_task.xml with left padding:

<com.google.android.material.textfield.TextInputLayout
    style="@style/TextInputLayout"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">
    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/editText"
        style="@style/RR_12"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Hiiiii"
        android:inputType="text"
        android:textColorHint="@color/lightGrayColor" />
</com.google.android.material.textfield.TextInputLayout>

Result screen : Without padding

So anyone can help or guide me what is causing this issue.

Update : My style(TextInputLayout) which is assign to textinputlayout view

<style name="TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
        <item name="boxStrokeColor">@color/darkWhiteColor</item>
        <item name="boxStrokeWidth">@dimen/one_dp</item>
        <item name="boxBackgroundColor">@color/textColorPrimary</item>
        <item name="boxCornerRadiusBottomStart">@dimen/ten_dp</item>
        <item name="boxCornerRadiusBottomEnd">@dimen/ten_dp</item>
        <item name="boxCornerRadiusTopEnd">@dimen/ten_dp</item>
        <item name="boxCornerRadiusTopStart">@dimen/ten_dp</item>
        <item name="hintTextAppearance">@style/TextInputLayoutHintStyle</item>
    </style>

0 Answers0