如何解决Android TextView在奇怪的地方自动换行
我在多行TextView中的奇怪地方遇到了自动换行的问题。有人知道我在做什么错吗?
这是xml布局:
<TextView
android:id="@+id/tvDescription2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:inputType="textMultiLine"
android:singleLine="false"
android:text="test"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvDescriptionTitle2" />
这是资源字符串:
<string name="labelFamilleParaben">Paraben: les propriétés antibactérienne et antifongique font qu\'il est généralement utilisé comme conservateur dans les cosmétiques. L\'utilisation de parabènes porte à controverse en raison de leur capacité à activer les récepteurs des œstrogènes,induisant une possible action sur la fertilité et les tumeurs œstrogéno-dépendantes,comme le cancer du sein. Ils ont également la réputation d\’avoir un pouvoir allergisant de contact et leur exploitation dans les produits cosmétiques est réglementée.</string>
这是Java代码:
String descriptionContent2="<ul>";
for(IngredientFamille ingredientFamille:ingredient.getDescription().getFamilles()){
if(ingredientFamille.getLabel()!=null)
descriptionContent2 += "<li> " + getContext().getString(ingredientFamille.getLabel())+"</li>";
}
descriptionContent2 += "</ul>";
TextView tvDescription2 = view.findViewById(R.id.tvDescription2);
tvDescription2.setText(Html.fromHtml(convertHtmlTagIfNeed(descriptionContent2)));
这是它的外观行:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。