极轻量的可展开和收缩内容的TextView

非常轻量的可展开和收缩内容的TextView,可用于listview等列表或普通布局情况
项目介绍:

最近在做类似朋友圈的功能,自定义了一个可伸展的textview,给大家开源出来。这是一个支持可展开和收缩内容的TextView,支持在listview等列表使用不错乱,支持在普通局部使用,支持配置展开/收起图标等属性

国际案例:有图有真相 项目地址ExpandableTextViewExample

效果预览图

支持配置属性:
  • 显示内容最大显示行数配置
  • 显示内容字体大小颜色配置
  • 展开/收起图标配置
  • 展开/收起位置配置
  • 展开/收起字体大小颜色配置
  • 展开/收起变化监听
使用方法
  • use Gradle:
dependencies {

compile 'com.jaydenxiao:ExpandableTextView:1.0.0'

}
  • Or Maven:
<dependency>
  <groupId>com.jaydenxiao</groupId>
  <artifactId>ExpandableTextView</artifactId>
  <version>1.0.0</version>
  <type>pom</type>
</dependency>
  • Or download the libray for your module:
布局文件
 <jaydenxiao.com.expandabletextview.ExpandableTextView
        android:id="@+id/etv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:animDuration="200"
        android:padding="8dp"
        app:collapseDrawable="@drawable/icon_green_arrow_down"
        app:collapseExpandGrarity="right"
        app:collapseExpandTextColor="@color/main_color"
        app:contentTextColor="@color/gray"
        app:contentTextSize="14sp"
        app:expandDrawable="@drawable/icon_green_arrow_up"
        app:maxCollapsedLines="5"
        app:textCollapse="@string/collapse"
        app:textExpand="@string/expand" />
设置text值
  • 普通情况
    expandableTextView.setText(“content”);
  • 列表情况(把item位置传入,记录状态)
    expandableTextView.setText(“content”,position);

最后附上项目地址ExpandableTextViewExample,欢迎fork and star

更多精彩文章请关注微信公众号”Android经验分享“:这里将长期为您分享Android高手经验、中外开源项目、源码解析、框架设计和Android好文推荐!
扫一扫加我哦

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值