我打开了一个错误,但我想知道是否有人遇到此问题并知道解决方法。
如果您定义一个带有提示的文本视图,请给它正确的重力(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则使用mHintLayout)。
你试过了吗android:ellipsize="start"
?过去当我需要提示并且需要提示时,这对我来说非常有效EditText
居中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)