Coder Social home page Coder Social logo

foldtext_java's Introduction

FoldText_Java

自定义折叠TextView

  • 支持文字设置在结尾或者另起一行
  • 支持设置点击事件
  • 支持设置提示文本内容
效果如下:

avatar

方法一控件为SpannableFoldTextView

Step 1

 <com.example.zzh.foldtext.SpannableFoldTextView
                android:id="@+id/text1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#fff"
                android:textColor="#000"
                app:showMaxLine="4"
                app:showTipAfterExpand="true"
                app:tipClickable="true"
                app:tipColor="@color/colorPrimary"
                app:tipGravity="0" />
  • showMaxLine 最大行数
  • showTipAfterExpand 点击展开后是否显示收起全文提示
  • tipClickable 提示是否可以点击
  • tipColor 提示文字颜色
  • tipGravity 提示文字位置 0-最后一行末尾,1-另起一行
  • isSetParentClick 是否为父View设置了点击事件
  • foldText 折叠时的提示文字
  • expandText 展开时的提示文字

Step 2

setText()

方法二控件为FoldTextView。

Step 1

 <com.example.zzh.foldtext.FoldTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#fff"
                android:textColor="#000"
                app:showMaxLine="4"
                app:showTipAfterExpand="true"
                app:tipClickable="true"
                app:tipColor="@color/colorPrimary"
                app:tipGravity="0" />
  • showMaxLine 最大行数
  • showTipAfterExpand 点击展开后是否显示收起全文提示
  • tipClickable 提示是否可以点击
  • tipColor 提示文字颜色
  • tipGravity 提示文字位置 0-最后一行末尾,1-另起一行
  • foldText 折叠时的提示文字
  • expandText 展开时的提示文字

Step 2

setText()

License

MIT

foldtext_java's People

Contributors

zzh12138 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.