Prevent TextView from wrapping in parent
Question
Solution
check out android:maxLines="1"
and if you want to add ending ...
add also android:ellipsize="end"
<TextView
android:id="@+id/name"
android:text="i want this to crop not wrap"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end" />
android:singleLine="true"
was deprecated in API Level 3.
OTHER TIPS
You're looking for android:singleLine="true"
.
Have you checked out android:scrollHorizontally. There is also a HorizontalScrollView if that doesn't work.
And in java code it's:
textView.setSingleLine();
textView.setHorizontallyScrolling(true);
worked for me.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow