Skip to content

Feature Request - Add baseline alignment support to TextInputLayout #13

@hkurokawa

Description

@hkurokawa

Overview

Context, problem or idea, solution or next step

Since 24.2.0, there is no way to align the baseline of the EditText surrounded by a TextInputLayout with the baseline of another component. I believe there are many situations where baseline alignment is required, such as showing an icon on the left of the input field, showing a unit label on the right of the field, and so on.

I am wondering if TextInputLayout could return the baseline position of its child with the getBaseline() method, the behaviour would be consistent and it would be helpful to many developers.

Thanks.

Screenshots/Video (if possible)

N/A

Stack trace (if possible)

N/A

Reproduction steps

In the below layout, @id/my_edit_text and @id/my_unit_label are not aligned on their baseline.

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <android.support.design.widget.TextInputLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/my_edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="text" />

    </android.support.design.widget.TextInputLayout>

    <TextView
        android:id="@+id/my_unit_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/unit_label"/>
</LinearLayout>

Version number

25.1.0

Operating system and device

All Android OS and Android devices

Related issues

https://code.google.com/p/android/issues/detail?id=224553

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions