android - EditText 提示随重力消失

我见过很多与这个类似的问题,但我认为这仍然是一个新领域:
1) 设置重力时提示文字消失
2) android:ellipsize="start" 修复了这个问题,因此您可以有居中的提示和居中的文本
3)为什么下面的代码仍然显示居中提示文本?

    <EditText
    android:id="@+id/details"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:hint="use this area to provide specific identification information including approximate size, vessel name and registration numbers if available"
    android:background="@android:drawable/editbox_background"
    android:layout_below="@id/details_title"
    />

是因为 fill_parent 而不是 wrap_content?我想也许是因为这个提示是多行的,但我缩短了它,它仍然出现并且居中。这些是这与我的其他需要 android:ellipsize="start" 才能正确显示的 EditText 之间的唯一区别。这只是一个错误吗?

最佳答案

您需要使用 android:gravity="top" 而不是 center 以使提示和文本从框的左上角开始。

https://stackoverflow.com/questions/5957772/

相关文章:

php - 如何使用 PHP 发送 HTML 格式的邮件?

vim - 在 Vim 中将光标移过长的软环绕行

javascript - getHours() 返回不正确的值

c# - String.Format 参数顺序烦人

awk - 带有 awk 的 pretty-print 表

perl - 使用 Perl 进行格式化输出的最佳方式

php - 为什么 PHP 回显的文本会丢失其格式?

c# - Html.HiddenFor 在 ASP.NET 中错误地格式化 DateTime

python - 在空格或连字符上拆分?

css - 防止eclipse破坏CSS格式