Deprecated singleLine attribute bug detected!

When see the deprecated warnings shown on singleLine attribute as below, sometimes feel like there’s no harm using it.

android:singleLine is deprecated: Use maxLines="1" insteaad

Strictly, maxLines is not a complete replacement of singleLine. Check out

Besides, there’s lots of debate on it, check out

Using is for a while, didn’t find any issue.

Bug Detected!!

Today, I discovered, a bug caused by singleLine="1" that exhibit in

It’s basically using animateLayoutChanges to animate the layout change when add or remove a view from a LinearLayout. While that is happening, it change a text of a TextView (where the width is changed as well).

Check out the OK changed to Normal that loose out the N and part of the o.

By changing the singleLine="true" to maxLines="1" in the MyStyle in style.xml file, the result is now okay.

Well, when you see a deprecated warning in the future, use it at your own risk :)

Click “❤” below to share. Thanks! ~Twitter:elye; Facebook:elye