LongTextView

Additional

Language
Java
Version
1.0 (Jul 15, 2016)
Created
Jul 15, 2016
Updated
Sep 2, 2016 (Retired)
Owner
Vladislav Matviienko (metalurgus)
Contributor
Vladislav Matviienko (metalurgus)
1
Activity
Badge
Generate
Download
Source code

Advertisement

Very long text support for Android

Features

  • split text into multiple parts, shown as list items in ListView
  • select max number of lines in a single item
  • select text size, color and gravity same way as in a regular TextView

How to use?

Add dependency (LongTextView is available through jitpack.io):

repositories {
    maven { url "https://jitpack.io" }
}
dependencies {
    compile 'com.github.metalurgus:LongTextView:1.0'
}

In your layout.xml file:

<com.metalurgus.longtextview.LongTextView 
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:gravity="left|top"
        app:maxLinesPerItem="2"
        app:text="@string/long_text"
        app:textColor="#ff0000"
        app:textSize="5dp" />

In your Java code

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

    LongTextView longTextView = (LongTextView) findViewById(R.id.view);
    longTextView.setText(getString(R.string.long_text));
}

License

See LICENSE file (GNU GENERAL PUBLIC LICENSE)