Text.BoringLayout Android TextView 中的 WIDTH 设置为 0(不显示) 当我有非英语文本时?

Text.BoringLayout WIDTH is set to 0 (not showing) in Android TextView When I have an non-English text?

我有一个 Android 小部件 TextView,当我用波斯语字符设置文本时,它就是不显示!我猜是 mBoring (Text.BoringLayout 属性) 造成的,因为宽度设置为 0.
当我设置英语+波斯字符串时没有问题,宽度设置为适当的值,如210。

mSubjectTextView = new TextView(mContext);
mSubjectTextView.setEllipsize(TextUtils.TruncateAt.END);
mSubjectTextView.setSingleLine(); // allow partial words to be elided
mSubjectTextView.setIncludeFontPadding(false);
ViewCompat.setLayoutDirection(mSubjectTextView, 1);
ViewUtils.setTextAlignment(mSubjectTextView, View.TEXT_ALIGNMENT_VIEW_START);

Typeface face = Typeface.createFromAsset(mContext.getAssets(),
        "fonts/byekan.ttf");
mSubjectTextView.setTypeface(face);

mSubjectTextView.setLayoutParams(new ViewGroup.LayoutParams(subjectWidth, subjectHeight));
mSubjectTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mCoordinates.subjectFontSize);
    layoutViewExactly(mSubjectTextView, subjectWidth, subjectHeight);


mSubjectTextView.setText("سلام");

canvas.translate(mCoordinates.subjectX, mCoordinates.subjectY);
mSubjectTextView.draw(canvas);

尝试通过 HTML 显示您的文字:

mSubjectTextView.setText(Html.fromHtml("سلام"));