android:scrollHorizontally="false"
 android:inputType="textMultiLine"
android:singleLine="false"

在你的textview 要加上这三行
用的时候

tv.setText("aa\nbb");
tv.setTest(Html.fromHtml("xxx<br>xxx<br>"));

但会阻止TextView向上冒泡,所以改为如下,也能实现类似的效果

android:singleLine="false"
android:lines="2"

转自:android textview换行

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐