Как установить отступ слева только для EditText без изменения заполнения подсказки внутри TextInputLayout? - PullRequest
0 голосов
/ 24 июня 2019

Когда я устанавливаю paddingStart для моего EditText внутри TextInputLayout, плавающая подсказка также перемещается влево.Как установить отступ для моего текста редактирования, сохраняя подсказку TextInputLayout, оставленную слева по умолчанию?

Ниже мой код:

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/cardNumberTil"
    style="@style/AuthTheme.NumberEditText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="32dp"
    app:hintTextAppearance="@style/CaptionLink">

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Some hint here"
            android:imeOptions="actionDone"
            android:inputType="number"
            android:maxLines="1"
            android:paddingStart="45dp"
            android:text="12345678"
            android:textAppearance="@style/Body1Style"
            tools:ignore="HardcodedText" />    
</com.google.android.material.textfield.TextInputLayout>


Here are styles:

<style name="Body1Style">
    <item name="android:fontFamily">@font/sans_serif_regular</item>
    <item name="android:textSize">16sp</item>
    <item name="android:lineSpacingExtra">8sp</item>
    <item name="android:textColor">#000000</item>
</style>

<style name="CaptionLink">
    <item name="android:fontFamily">@font/roboto_regular</item>
    <item name="android:textSize">12sp</item>
    <item name="android:textStyle">normal</item>
    <item name="android:lineSpacingExtra">8sp</item>
    <item name="android:textColor">#0089d0</item>
</style>

<style name="AuthTheme.NumberEditText" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
    <!-- Hint color and label color in FALSE state -->
    <item name="android:textColorHint">@color/textColorSubtitle1Gray</item>
    <!-- Label color in TRUE state and bar color FALSE and TRUE State -->
    <item name="colorAccent">@color/cerulean</item>
    <item name="colorControlNormal">@color/cerulean</item>
    <item name="colorControlActivated">@color/cerulean</item>
    <item name="android:fontFamily">@font/roboto_regular</item>
    <item name="android:textSize">12sp</item>
    <item name="android:textStyle">normal</item>
    <item name="android:lineSpacingExtra">8sp</item>
</style>

желаемое изображение на выходе

...