Positioning hint within multiline EditText - TextInputLayout

寵の児 提交于 2019-12-04 03:32:09

问题


I have an EditText that has 4 lines (min=4; >4 scrolls). The EditText is embedded in a TextInputLayout. The hint displayed for this seems to be centered vertically. I'd like it at the start of the 1st line, naturally.

Important Edit: Testing without TextInputLayout allows for the hint to be positioned effectively. The problem lies with this. Any insight into how to resolve it is appreciated.

<android.support.design.widget.TextInputLayout
    android:id="@+id/text_input_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:focusableInTouchMode="true">

    <EditText
        android:id="@+id/status"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:fadeScrollbars="false"
        android:gravity="left"
        android:hint="What's going on?"
        android:inputType="textMultiLine"
        android:lines="4"
        android:minLines="4"
        android:scrollbarStyle="outsideInset"
        android:scrollbarThumbVertical="@drawable/custom_scrollbar_style"
        android:scrollbars="vertical"
        android:textColorHint="@color/black_semi_transparent" />

    <TextView
        android:id="@+id/text_count"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ems="10"
        android:text="140"
        android:textColor="@color/black_semi_transparent" />

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


回答1:


This bug has been fixed in the v23 support libraries:

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



来源:https://stackoverflow.com/questions/31136234/positioning-hint-within-multiline-edittext-textinputlayout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!