All Projects → freecats → Textviewexpandableanimation

freecats / Textviewexpandableanimation

Expandable TextView With Smooth Transition Animation

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Textviewexpandableanimation

CustomFontView
Custom View classes for TextView, EditText & Buttons - to set custom fonts
Stars: ✭ 26 (-95.16%)
Mutual labels:  textview
Dropdowntextview
Simple drop-down(expandable) TextView for Android
Stars: ✭ 307 (-42.83%)
Mutual labels:  textview
Stacklabel
🔥空祖家的堆叠标签(以下碎念:一开始起名字“StackLabel”没想太多结果被人吐槽Stack是整齐堆叠的意思...........好吧这是我的锅不过现在要改也来不及了,好用就行了...吧?
Stars: ✭ 471 (-12.29%)
Mutual labels:  textview
Gradienttextview
一个颜色逐渐改变的textview,类似歌词效果
Stars: ✭ 267 (-50.28%)
Mutual labels:  textview
Spedittool
An efficient and scalable library for inputing and displaying gif or @mention on graph-text mixed TextView/EditText
Stars: ✭ 292 (-45.62%)
Mutual labels:  textview
Advancedtextview
一个增强的TextView库。可以实现文字两端对齐,文字竖排,以及自定义选择文字后的弹出菜单。
Stars: ✭ 365 (-32.03%)
Mutual labels:  textview
textmatcher
A simple text watcher that matches specific targets like mention or hashtag in a string by defining rules
Stars: ✭ 67 (-87.52%)
Mutual labels:  textview
Kotlinextensions.com
A handy collection of most commonly used Kotlin extensions to boost your productivity.
Stars: ✭ 522 (-2.79%)
Mutual labels:  textview
Attributedstring
基于Swift插值方式优雅的构建富文本, 支持点击长按事件, 支持不同类型过滤, 支持自定义视图等.
Stars: ✭ 294 (-45.25%)
Mutual labels:  textview
Inputkit
📝InputKit, an Elegant Kit to limits your input text, inspired by BlocksKit, written in both Objective-C & ⚡️Swift.
Stars: ✭ 420 (-21.79%)
Mutual labels:  textview
Android Expandabletextview
An expandable TextView for Android applications
Stars: ✭ 268 (-50.09%)
Mutual labels:  textview
Swiftuix
Extensions and additions to the standard SwiftUI library.
Stars: ✭ 4,087 (+661.08%)
Mutual labels:  textview
Countanimationtextview
A tiny Android library makes very easier count animation of TextView.
Stars: ✭ 392 (-27%)
Mutual labels:  textview
TTInputVisibilityController
Lightweight controller to keep your inputs visible when the keyboard is presented.
Stars: ✭ 21 (-96.09%)
Mutual labels:  textview
Flipview
Flipping views like Gmail & beyond
Stars: ✭ 477 (-11.17%)
Mutual labels:  textview
LycricsTextView
No description or website provided.
Stars: ✭ 14 (-97.39%)
Mutual labels:  textview
Rtextview
基于TextView 1.直接设置selector背景2.直接设置drawableLeft大小 3.圆角,圆形,背景/边框/文字根据状态变色
Stars: ✭ 359 (-33.15%)
Mutual labels:  textview
Simplifyspan
A easy-to-use and powerful Spannable library
Stars: ✭ 522 (-2.79%)
Mutual labels:  textview
Htmlbuilder
Build valid HTML for Android TextView
Stars: ✭ 506 (-5.77%)
Mutual labels:  textview
Text Decorator
Decorate your TextView easily
Stars: ✭ 402 (-25.14%)
Mutual labels:  textview

TextViewExpandableAnimation#

Expandable TextView With Smooth Transition Animation

Preview

preview

How to get it work?

  • Clone or download my project

  • Copy TextViewExpandableAnimation.java and some resource files such as attrs.xml into your own project

  • in xml layout file

<com.freecats.demo.view.TextViewExpandableAnimation xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/tv_expand"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:tvea_expandBitmap="@drawable/icon_green_arrow_down"
        app:tvea_expandLines="3"
        app:tvea_shrinkBitmap="@drawable/icon_green_arrow_up"
        app:tvea_textContentColor="@color/color_gray_light_content_text"
        app:tvea_textContentSize="@dimen/sp_txt_size_content"
        app:tvea_textExpand="@string/expand"
        app:tvea_textShrink="@string/shrink"
        app:tvea_textStateColor="@color/colorPrimary" />

in java

     TextViewExpandableAnimation tvExpand = (TextViewExpandableAnimation) findViewById(R.id.tv_expand);
     tvExpand.setText(text);

All Done!

If you use it as an item in RecyclerView, you may have to make sure your RecyclerView Adapter's onBindViewHolder looks like this to avoid Unexpected Shrink/Expand State.

@Override
    public void onBindViewHolder(RecyclerViewAdapter.ViewHolder holder, final int position) {
        //record its state
        holder.tvExpand.setOnStateChangeListener(new TextViewExpandableAnimation.OnStateChangeListener() {
            @Override
            public void onStateChange(boolean isShrink) {
                ContentModel cm = mLists.get(position);
                cm.setShrink(isShrink);
                mLists.set(position, cm);
            }
        });
        holder.tvExpand.setText(mLists.get(position).getText());
        //important! reset its state as where it left
        holder.tvExpand.resetState(mLists.get(position).isShrink());

    }


Attributes Support as below

Attributes format
tvea_expandLines integer
tvea_expandBitmap reference
tvea_shrinkBitmap reference
tvea_textContentColor color
tvea_textContentSize dimension
tvea_textExpand string
tvea_textShrink string
tvea_textStateColor color

License

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].