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 paranes 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>&nbsp;" + getContext().getString(ingredientFamille.getLabel())+"</li>";
                }
                descriptionContent2 += "</ul>";

                TextView tvDescription2 = view.findViewById(R.id.tvDescription2);
                tvDescription2.setText(Html.fromHtml(convertHtmlTagIfNeed(descriptionContent2)));

这是它的外观行:

line break after "les"

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)