我有以下要设置为TextView的html代码。我希望第二行是居中对齐的。即使添加左边填充后,我也看不到文本与中心对齐。
String title = "<span style='font-family:Avenir Roboto Regular; font-size:16pt'>Howdy doing.<br></span><span style='font-family:Roboto Regular; font-size:16pt'>Doing great:</span>"
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
textview.setText(Html.fromHtml(title, Html.FROM_HTML_MODE_LEGACY));
} else {
textview.setText(Html.fromHtml(title));
}