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);//設置是否已展開
相關文章
相關標籤/搜索