TextView文本折叠Three

前两篇解决了一些问题,可是今天使用又出现了新的问题。添加在Listview中会出现布局错乱!git

So  在次解决!github

https://github.com/timqi/CollapsibleTextView布局

首先设置依赖spa

dependencies { compile 'com.timqi.collapsibletextview:library:1.1.2' }

而后在Va'lues==》attrs中设置code

<declare-styleable name="CollapsibleTextView">
    <attr name="suffixColor" format="color"/>
    <attr name="collapsedLines" format="integer"/>
    <attr name="collapsedText" format="string"/>
    <attr name="expandedText" format="string"/>
    <attr name="suffixTrigger" format="boolean"/>
</declare-styleable>

这几个参数分别表示orm

  • 后缀颜色,也就是「显示全文」,「隐藏」这几个字的颜色
  • 折叠后显示几行文字
  • 折叠后的后缀文字,也就是「显示全文」
  • 展开后的后缀文字,也就是「隐藏」
  • 隐藏与展现的触发事件是点击后缀仍是整个 TextView

使用事件

viewHolder.tvContent.setFullString(listBean.getContent());//设置文本
viewHolder.tvContent.setExpanded(false);//设置是否已展开
相关文章
相关标签/搜索