I have an EditText
that I am trying to set开发者_JAVA百科 with a very long, unbreaking text value (a URL), but even with the following XML declaration, the text is breaking to a second line.
<EditText
android:id="@+id/address"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:maxLines="1"
android:hint="Enter URL"
android:text="http://www.example.com/news/2010-07-15/this-is-the-story-title-here.html">
</EditText>
I've tried the solutions here (adding android:ellipsize="end"
), but it made no difference. Reducing the text in length to something no more than the length of the EditText
worked... but this is realistic for a URL EditText
.
Any suggestions?
Thanks,
Paul
Set
android:scrollHorizontally="true"
Have you tried adding android:singleLine="true"
to the mix
<EditText
android:id="@+id/address"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:singleLine="true"
android:maxLines="1"
android:hint="Enter URL"
android:text="http://www.example.com/news/2010-07-15/this-is-the-story-title-here.html">
</EditText>
Use value for the attribute inputType
other than textMultiLine
. The attribute singleLine
is deprecated.
精彩评论