Skip to content

Instantly share code, notes, and snippets.

@PepDevils
Last active February 13, 2017 16:00
Show Gist options
  • Save PepDevils/d98aa743102d6879a4bda0f2d6f57502 to your computer and use it in GitHub Desktop.
Save PepDevils/d98aa743102d6879a4bda0f2d6f57502 to your computer and use it in GitHub Desktop.
//java class
JustifiedTextView id_example = (JustifiedTextView) v.findViewById(R.id.id_example);
//limpar todo o "[" e "]" bem como o que está entre os mesmos.
//Usado quando o html vem com shortcodes tipo:[vc_row].
String clean_string = string_example.replaceAll("\\[.*?\\]", "");
//mostrar string com elemntos do html
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
id_example.setText(Html.fromHtml(newsContent, Html.FROM_HTML_MODE_COMPACT));
}else{
id_example.setText(Html.fromHtml(newsContent));
}
//xml layout
<com.uncopt.android.widget.text.justify.JustifiedTextView
android:id="@+id/id_example"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingMultiplier="1.4"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
android:layout_marginBottom="10dp"
>
//compile
compile 'com.uncopt:android.justified:1.0'
//link
// https://github.com/programingjd/justified
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment