Skip to content

Latest commit

 

History

History
63 lines (29 loc) · 1.45 KB

README.md

File metadata and controls

63 lines (29 loc) · 1.45 KB

ExpandableTextView

small View variation that enable you to limit text int view and offer "ReadMore button".


Usage is simple. Just, in your layout XML, use ExpandableTextView view with appropriate attributes:

<com.eutechpro.expandabletextview.ExpandableTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        custom:text="@string/some_text"
        custom:expand_label="@string/load_more"
        custom:collapse_label="@string/collapse"
        custom:limit="200"
        />

Attributes:

  • text: text content of your TextView (text or string resource)
  • expand_label: label of "button" that will expand text (text or string resource)
  • colapse_label: label of "button" that will collapse text (text or string resource)
  • limit: amount of characters to "break" content text on

Do not forget to use custom namespace: xmlns:custom="http://schemas.android.com/apk/res-auto"

If you do not set "collapse_label", after expanding, there will be no collapse button.

For gradient effect under "LoadMore"

feel free to edit drawable file: "bottom_up_transparent_gradient.xml"

Expanding/Collapsing:

Roadmap

  • Add someting like "OnCollapsedListener"