RichTextView


Source link: https://github.com/androidessence/RichTextView

RichTextView Library

This library is an enhancement to the TextView component that allows you to style various spans of text inside the view.

Usage

To have access to the library, add the following dependency to your build.gradle:

 compile 'com.androidessence.lib:richtextview:1.0.4'

Format Types

You can apply any combination of the following formats on a span of text:

  • Bold
  • Italic
  • Underline
  • Strikethrough
  • Superscript
  • Subscript

To use these, use one of the following formatSpan methods:

  • formatSpan(int start, int end, FormatType formatType)
    • This method is used to apply a certain format to a span of text in the RichTextView. Start (inclusive) and end (exclusive) are the indexes of the start and end characters to format.
  • formatSpan(int start, int end, EnumSet<FormatType> formatTypes)
    • This method has the same function as the one above, but allows you to apply a number of FormatTypes to this span of text.
  • formatNumberSpan(int startline, int endline)
    • This method is used to apply NumberSpan based on the start and end line specified.
  • formatBulletSpan(int startline, int endline)
    • This method is used to apply Bullets based on start and end lines.
  • formatImageSpan(int start, int end, Bitmap bitmap)
    • This method is used to apply ImageSpan based on the start and end line specified along with a bitmap specified.
  • formatFadeInSpan(int startIndex, int endIndex)
    • This method fades in text that starts with startIndex and ends with endIndex.

Color Format Types

You can apply the following color formats on a span of text:

  • Foreground (the text color)
  • Highlight (the background color of the span)

To use these formats, use the following method:

  • colorSpan(int start, int end, FormatType formatType, int color)
    • This method functions just as the ones above it, the only difference is that it also requires a color to apply to the span. For example, if you wanted to make the first four characters of text blue, you would use colorSpan(0, 5, FormatType.FOREGROUND, Color.BLUE);

Hyperlinks

You can add a hyperlink to a section of the text using the following method :

  • addHyperlinkToSpan(int start, int end, final String url)
    • This method adds a hyperlink to the text from indices start to end. Clicking on the text will open the browser and load it with the url parameter.`

Sample

Below is a sample of all the possible formats you can apply to a RichTextView. In this example it is all one string, formatted eight different ways.

Credits & Contact

This library was created by Adam McNeilly with special help from:

It is also released under Android Essence blog.

License

The RichTextView library is available under the MIT License. You are free to modify and enhance it in any way. If you submit a pull request, please add your name into the credits section! :)

Resources

This library can help to configure strikethrough, color & blur on a part of text in TextView easily.

RxAnimations is a library with the main goal to make android animations more solid and cohesive.

Create square float action button using this example!

In this example we are creating an square floating action button which will be different from float action button, but will work the same

Are you creating a music app? Or maybe you want to add some creative detail to an existing one? Then you’ve come to the right place! Play Widget for Android created by Cleveroad can be easily integrated with your music app to spruce the user experience up. Break the monotony and make your music player unique!

New distinct things encourage users to launch your app again. Add the Play Widget component to your app and enjoy the benefits — it’s easy as one-two-three.

Android 3rd party library to make implementing galleries more easier.

RealmRepository generates classes with access to Realm database. Library uses repository pattern, each generated class supports database operations on certain type. Project was inspired by Spring Data JPA.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes