material-components / material-components-android

Modular and customizable Material Design UI components for Android
Apache License 2.0
16.24k stars 3.05k forks source link

[TextInputEditText] minEms is not working #2269

Closed IgoBobrov closed 2 years ago

IgoBobrov commented 3 years ago

Description: TextInputEditText minEms is not working, on 1.3.0 ver all works fine

Expected behavior: minEms must set width of TextInputEditText by value

Source code: <com.google.android.material.textfield.TextInputEditText android:id="@+id/etPhoneNumber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/edit_text_background" android:inputType="phone" android:maxLines="1" android:minEms="9" android:padding="6dp" android:singleLine="true" android:textCursorDrawable="@drawable/edit_text_cursor" android:textSize="@dimen/text_size_extra_large" />

Android API version: 28, 29

Material Library version: 1.4.0-rc01

Device: Xiaomi MI11, emulator API 28, Android Studio Layout Editor also

gchandrakanth89 commented 3 years ago

android:ems="8" is also not working with com.google.android.material:material:1.4.0

klaus19 commented 2 years ago

I'll work on this to solve the issue.

klaus19 commented 2 years ago

In which xml file this above code is present?

gchandrakanth89 commented 2 years ago

In which xml file this above code is present?

I have multiple layout files in my app. In each layout file the issue is coming. I think the issue is only with material:1.4.0. With v1.3.0 its working fine

klaus19 commented 2 years ago

Okay, let me check!

paulfthomas commented 2 years ago

minEms and maxEms should work now, they need to be set on the TextInputLayout (which should use android:layout_width="wrap_content") and not the TextInputEditText though.

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:minEms="10">

    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</com.google.android.material.textfield.TextInputLayout>
gchandrakanth89 commented 2 years ago

The issue is not solved it seems. I am using com.google.android.material:material:1.5.0 below is my TextInputLayout xml contents

<com.google.android.material.textfield.TextInputLayout
                android:id="@+id/textInputLayout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="20dp"
                android:minEms="10"
                android:hint="Name"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/button">

                <com.google.android.material.textfield.TextInputEditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />
            </com.google.android.material.textfield.TextInputLayout>

Its still not working

paulfthomas commented 2 years ago

Sorry for not specifying it in my previous comment, the fix should be part of the next release.

jcarlos79t commented 2 years ago

no funciona en la version 'com.google.android.material:material:1.6.0-alpha02'

gchandrakanth89 commented 2 years ago

The issue is not solved it seems. I am using com.google.android.material:material:1.5.0 below is my TextInputLayout xml contents

<com.google.android.material.textfield.TextInputLayout
                android:id="@+id/textInputLayout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="20dp"
                android:minEms="10"
                android:hint="Name"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/button">

                <com.google.android.material.textfield.TextInputEditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />
            </com.google.android.material.textfield.TextInputLayout>

Its still not working

Tested in version 1.6.0 and working as expected