Customized and Expandable TextView

Overview

Customized and Expandable TextView

Simple library to change the Textview as rectangle, circle and square shapes by adding one line of code in xml file.Multiple features are implemented and wrapped into single textview.

Features

1.Textview shape -> rectangle, square and circle shapes
2.Expandable textview
3.Font change via xml
4.UnderLine textview via xml
5.Strike through text via xml
6.CheckedTextView
7.Disable checkedTextView
8.Added ripple effect on click

the above features are done through xml file.

Screenshot

Implementation

Using Gradle:


dependencies {
    implementation 'com.libRG:customtextview:2.2'
}

Import as Module

Download the .aar file using below link and add this as module into your project

[Donwload module])https://github.com/Rajagopalr3/CustomizedTextView/blob/rajgopalr3/customtextview-2.1.aar

dependencies {
     implementation project(':customtextview')
}

Add this into settings.gradle file:
include ':customtextview'

XML

 <com.libRG.CustomTextView
                android:id="@+id/c6"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:lib_setFont="@string/droidSansBold"
                app:lib_setRadius="3dp"
                android:text="rectagular textview"
                app:lib_setRoundedBorderColor="@color/colorPrimary"
                app:lib_setRoundedView="true"
                app:lib_setShape="rectangle"/>

                      

Set Font

Add your font files into assets folder. In string.xml files find your font files like below

    <string name="DroidSansBold">DroidSans-Bold.ttf</string>
    

Change Logs [v1.6]

  1. Bug fixes - creating customtextview by programmatically
  2. Removed unused lines in library

Change Logs [v1.3]

  1. Able to change the expanded and collapse hint
  2. Bug fixes.

Change Logs [v1.2]

New feature:

  1. Added strike through text
  2. Added CheckedTextView with custom listener.
  3. We can set custom drawables, drawableTint color for checked & unchecked states

Bug Fixes:

  1. Fixed the click events in various views like event in underlineText view, rectangle text.
  2. Removed unused codes.

Attributes

Attributes Description Default Value
lib_setRoundedView if true rounded view enabled false in default
lib_setShape if roundedview true, set shape rectangle in default
lib_setStrokeWidth set stroke width in dp 1 dp in default
lib_setRoundedBorderColor set stroke color current theme's accent color
lib_setRadius set corner radius of rectangle 1 dp in default
lib_setRoundedBGColor set BG color of rectangle,circle transparent color in default
lib_setFont set font name in string android's default font
lib_setExpandableText if true expandable text enabled false in default
lib_setActionTextVisible set visibility if action text false in default
lib_setActionTextColor set color of action text current theme's accent color
lib_setTrimLines set lines to trim in textview 0 in default
lib_setUnderLineText set underline to text in textview false in default
lib_setStrikeText set strike through text in view false in default
lib_setCheckedText set checked mode enable in view false in default
lib_setChecked change state as checked unchecked
lib_checkedDrawable set checked drawable icon default checked icon added
lib_unCheckedDrawable set unchecked drawable icon default unchecked icon added
lib_checkMarkTint set drawable color in textview default color
lib_disableCheckedTextClick set clickable true or false bydefault false
lib_checkedIconPosition set checkBox position right side in default
lib_checkedDrawablePadding set checkBox padding in view 5dp in default
lib_setExpandHint set readmore hint like "show more" "more" in default
lib_setCollapseHint set readless hint like "less" "less" in default
lib_enable_ripple_effect enable ripple effect false in default
lib_setRippleColor set ripple color transparent color in default

License


Copyright 2017 Rajagopal

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Comments
  • StringIndexOutOfBoundsException

    StringIndexOutOfBoundsException

    Thank you for great library!

    I found issue when you calculate trimEndIndex in line 153: int trimEndIndex = lineEndIndex - (ELLIPSIZE.length() + defValue[0].length() + 1);

    it sometimes throw an exception:

    Fatal Exception: java.lang.StringIndexOutOfBoundsException at android.text.SpannableStringBuilder.(SpannableStringBuilder.java:61) at com.libRG.CustomTextView.updateCollapsedText(SourceFile:154) at com.libRG.CustomTextView.getTrimmedText(SourceFile:142) at com.libRG.CustomTextView.setText(SourceFile:126) at com.libRG.CustomTextView.access$300(SourceFile:44) at com.libRG.CustomTextView$2.onGlobalLayout(SourceFile:368) at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:1013) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2692) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1785) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7833) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) at android.view.Choreographer.doCallbacks(Choreographer.java:723) at android.view.Choreographer.doFrame(Choreographer.java:658) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6944) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

    Best regards, Jack

    opened by jczerski 2
  • Bug : Unable hide shape of background view

    Bug : Unable hide shape of background view

    When setVisibility is GONE background view should be hidden too . But this doesn't have any effect. Even if try to programmatically try to change the setBorderView(false).

    opened by dineshmm23 1
  • Allow rtl support for padding start and end

    Allow rtl support for padding start and end

    android:paddingStart="12dp"
    android:paddingEnd="12dp"
    

    Above doesn't work when using for rounded view app:lib_setRoundedView="true"

    opened by dineshmm23 1
  • Not work when textview is in scrollview/multiple horizontal recycleview in same screen

    Not work when textview is in scrollview/multiple horizontal recycleview in same screen

    Not work when textview is in scrollview/multiple horizontal recycleview in same screen.

    Inside vertical scroll does not show read more option.

    In horizontal recycle view some time it come , some times not

    opened by sagargadani 1
  • Apache 2.0 License means you need to upload the library module

    Apache 2.0 License means you need to upload the library module

    Apache 2.0 License means you need to upload the library module and the same is missing. If you don't want to be reported against Github for license violation and get your account closed then you MUST upload the library code or change the license type to one less permissive.

    opened by mradzinski 1
  • App crashes on android 4.4 due to android.graphics.drawable.RippleDrawable

    App crashes on android 4.4 due to android.graphics.drawable.RippleDrawable

    App crashes on android 4.4 due to android.graphics.drawable.RippleDrawable. for android 4.4 it should be Drawable the RippleDrawable is missing in 4.4. help fix this.

    opened by zeoharlem 0
Owner
Raja Gopal
Android Developer|Passionate Developer
Raja Gopal
Mentions-TextView - Make Mentions and hashtags clickable in Textview

Mentions Textview Custome Textview with Mentions and hashtags being clickable. D

null 2 Jan 9, 2022
Customized and RoundedEditText

CustomEditText A Collection of features are wrapped into single UI element. By adding a line code in xml, able to access these features,rectangular vi

Raja Gopal 154 Oct 5, 2022
Light-weighted, convenient implementation of expandable text view that supports expanding & collapsing animations for Android projects

ExpandableTextView Light-weighted, convenient implementation of expandable text view that supports expanding & collapsing animations for Android proje

Giang H. Pham 22 Jan 6, 2023
AutoLinkTextView is TextView that supports Hashtags (#), Mentions (@) , URLs (http://), Phone and Email automatically detecting and ability to handle clicks.

AutoLinkTextView Deprecated Please use the new version of AutoLinkTextView AutoLinkTextView is TextView that supports Hashtags (#), Mentions (@) , URL

Arman 1.1k Nov 23, 2022
Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Provides easy means to validate with dependencies.

android-formidable-validation Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Pr

Linden 147 Nov 20, 2022
A TextView that automatically fit its font and line count based on its available size and content

AutoFitTextView A TextView that automatically fit its font and line count based on its available size and content This code is heavily based on this S

null 899 Jan 2, 2023
Implementation of a TextView and all its direct/indirect subclasses with native support for the Roboto fonts, includes the brand new Roboto Slab fonts.

Android-RobotoTextView Implementation of a TextView and all its direct/indirect subclasses with native support for the Roboto fonts, includes the bran

Evgeny Shishkin 782 Nov 12, 2022
An extension of Android's TextView, EditText and Button that let's you use the font of your choice

AnyTextView (deprecated) Note: AnyTextView is no longer being maintained. I recommend replacing AnyTextView with the Calligraphy library instead. Frus

Hans Petter Eide 165 Nov 11, 2022
Simple way to create linked text, such as @username or #hashtag, in Android TextView and EditText

Simple Linkable Text Simple way to create link text, such as @username or #hashtag, in Android TextView and EditText Installation Gradle Add dependenc

Aditya Pradana Sugiarto 76 Nov 29, 2022
Animation effects to text, not really textview

HTextView Animation effects with custom font support to TextView see iOS Effects see Flutter Effects Screenshot type gif Scale Evaporate Fall Line Typ

hanks 5.5k Jan 5, 2023
Android's TextView that can expand/collapse like the Google Play's app description

ExpandableTextView ExpandableTextView is an Android library that allows developers to easily create an TextView which can expand/collapse just like th

Manabu S. 4k Dec 28, 2022
A library to show emoji in TextView, EditText (like WhatsApp) for Android

Discontinued This projected is discontinued. Please consider using other alternative, i.e EmojiCompat. Contact me if you want to continue working on a

Hieu Rocker 3.6k Jan 5, 2023
A TextView that automatically resizes text to fit perfectly within its bounds.

AutoFitTextView A TextView that automatically resizes text to fit perfectly within its bounds. Usage dependencies { compile 'me.grantland:autofitt

Grantland Chew 4.2k Jan 1, 2023
Android experiment showing a sinking TextView

Titanic is an Android experiment reproducing this effect.

Romain Piel 1.8k Dec 15, 2022
A Custom TextView with trim text

ReadMoreTextView A Custom TextView with trim text Download To add the ReadMoreTextView library to your Android Studio project, simply add the followin

Borja B. 1.7k Dec 29, 2022
Advanced Android TextView

Advanced Android TextView Companion app for my Advanced Android TextView talk, demostrating: Animated CompoundDrawable Text shadow Custom font Non-bre

Chiu-Ki Chan 1.2k Dec 9, 2022
A TextView that simulates the effect from the app Secret where the characters fade in/out at different speeds.

SecretTextView A TextView that simulates the effect from the app Secret where the characters fade in/out at different speeds. How To Use Use it just l

Matt Kula 611 Nov 7, 2022
This is based on an open source autosizing textview for Android.

SizeAdjustingTextView This is based on an open source autosizing textview for Android I found a few weeks ago. The initial approach didn't resize mult

Elliott Chenger 255 Dec 29, 2022
Lightweight android library for highlighting sections of a textview, with optional callbacks.

Linker Lightweight android library for highlighting Strings inside of a textview (ignoring case), with optional callbacks. Language: Java MinSDK: 17 J

Josh Gainey 35 Apr 30, 2022