I have an Android Widget TextView, when I setText with Persian charachters, it just not showing! and I guess the mBoring (Text.BoringLayout property) is responsible, because the width is set 0.
there is no problem when I set english + persian strign, and the width set to proper value such as 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);
Aucun commentaire:
Enregistrer un commentaire