我已经打开了一个错误,但我想知道是否有人遇到过这个问题并且知道解决方法。如果你定义一个带有提示的文本视图,给它正确的重力 (android:gravity="right") 然后如果你定义 android:singleLine=true 或 android:maxLines="1" 或 android:scrollHorizonatally="true"你没有看到提示。删除正确的重力将提示返回到左侧,删除我上面提到的所有树参数将提示放在右侧。我想要我的提示在右边,但我需要一条水平线......
这是不显示提示的示例布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<EditText android:layout_width="fill_parent"
android:layout_gravity="center_vertical|right"
android:layout_height="wrap_content"
android:layout_margin="6dp"
android:textSize="16sp"
android:paddingRight="5dp"
android:id="@+id/c"
android:gravity="right"
android:hint="hello!!!"
android:scrollHorizontally="true"
android:maxLines="1"
android:singleLine="true"/>
</LinearLayout>
我检查了 1.6 和 2.1 模拟器,它重现了 100%,我很确定这是一个错误,我没有看到单行和提示之间的联系....更重要的是,提示在 TextView 中有自己的布局( mLayout 和 mHintLayout 都存在,在 onDraw 如果文本长度为 0 mHintLayout 如果 mHint 不为 null 则使用)。