Source:
<code>private static TextView createField(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent, @NonNull final FormField field, @NonNull final String value, boolean readOnly, @NonNull View.OnClickListener onClickListener) { final TextView textView = (TextView) inflater.inflate(R.layout.edit_user_profile_field, parent, false); final SpannableString formattedValue = new SpannableString(value); formattedValue.setSpan(new ForegroundColorSpan(parent.getResources().getColor(R.color.edx_brand_gray_base)), 0, formattedValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(ResourceUtil.getFormattedString(parent.getResources(), R.string.edit_user_profile_field, new HashMap<String, CharSequence>() {{ put("label", field.getLabel()); put("value", formattedValue); }})); textView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT < 16) { textView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } else { textView.getViewTreeObserver().removeOnGlobalLayoutListener(this); } String contentDescription = TextUtils.ellipsize(textView.getText(), textView.getPaint(), (float) textView.getWidth(), TextUtils.TruncateAt.END).toString(); <START> textView.setContentDescription(contentDescription); <END> } }); Context context = parent.getContext(); TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds( textView, null, null, new IconDrawable(context, FontAwesomeIcons.fa_angle_right) .colorRes(context, R.color.edx_brand_gray_back) .sizeDp(context, 24), null); if (readOnly) { textView.setEnabled(false); textView.setBackgroundColor(textView.getResources().getColor(R.color.edx_brand_gray_x_back)); } else { textView.setOnClickListener(onClickListener); } parent.addView(textView); return textView; }</code><technical_language>do want do this? If truncated text is truncated in TalkBack, extend TextView provide this behaviour generally</technical_language>

Target:
private static TextView createField(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent, @NonNull final FormField field, @NonNull final String value, boolean readOnly, @NonNull View.OnClickListener onClickListener) { final TextView textView = (TextView) inflater.inflate(R.layout.edit_user_profile_field, parent, false); final SpannableString formattedValue = new SpannableString(value); formattedValue.setSpan(new ForegroundColorSpan(parent.getResources().getColor(R.color.edx_brand_gray_base)), 0, formattedValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(ResourceUtil.getFormattedString(parent.getResources(), R.string.edit_user_profile_field, new HashMap<String, CharSequence>() {{ put("label", field.getLabel()); put("value", formattedValue); }})); Context context = parent.getContext(); TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds( textView, null, null, new IconDrawable(context, FontAwesomeIcons.fa_angle_right) .colorRes(context, R.color.edx_brand_gray_back) .sizeDp(context, 24), null); if (readOnly) { textView.setEnabled(false); textView.setBackgroundColor(textView.getResources().getColor(R.color.edx_brand_gray_x_back)); } else { textView.setOnClickListener(onClickListener); } parent.addView(textView); return textView; }