I want to dynamically display text in a TextView. The text will come from the server dynamically. It can be one word or one line or paragraph. The text displays a view with a size of 56sp based on customer requirements.
My problem here is that the application displays text in a huge size. In the event of a word break at the end of the line, the OS does not automatically display a hyphen ("-") below the Marshmallow devices.
for example: Text: "Migration data is now available" It appears in the user interface as
Transfer
data is now ava
ilable
I want to show it as
Transfer
now ava data is
ilable.
But this works correctly on Marshmallow or higher devices.
The TextView property is shown below.
<TextView android:id="@+id/tv_primary_headline" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:fontFamily="sans-serif-black" android:lineSpacingExtra="@dimen/promo_primarytext_line_spacing" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="@color/navigation_selection_color" android:textSize="@dimen/promo_primary_headline_size" android:textStyle="bold" android:visibility="visible" /> TextView mTvPrimaryHeadline = (TextView) view. findViewById(R.id.tv_primary_headline); this.mTvPrimaryHeadline.setText(Html.fromHtml(title));
source share