MediumTextView Documentation

repository·master·Indexed 19 days ago

https://github.com/angebagui/medium-textview

An Android custom view for efficiently displaying CMS-generated content. It is optimized for specific HTML elements including paragraphs (<p>), images (<img>), and videos in iframes (<iframe>), providing an alternative to standard WebViews.

Tokens
529
Snippets
3
Records
4
Agent score
17%

What's inside MediumTextView

  1. Add MediumTextView to your layout XML

    master

    Include the io.github.angebagui.mediumtextview.MediumTextView component in your XML layout. It is recommended to wrap it in a ScrollView since the content is intended to be scrollable.

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <io.github.angebagui.mediumtextview.MediumTextView
            android:id="@+id/medium_text_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/activity_horizontal_margin"
            android:layout_marginBottom="@dimen/activity_vertical_margin"
            />
    </ScrollView>
  2. Display HTML content with MediumTextView

    master

    To render content, find the MediumTextView by its ID and call setText() passing the HTML string. The view supports the following HTML tags:

    • Paragraphs: <p></p>
    • Images: <img/>
    • Videos in Iframes: <iframe></iframe>
    MediumTextView mediumTextView = (MediumTextView)findViewById(R.id.medium_text_view);
    mediumTextView.setText(getContentHtml());