AndroidTextView實現(xiàn)多文本折疊、展開效果-創(chuàng)新互聯(lián)

背景

創(chuàng)新互聯(lián)公司成立于2013年,先為正寧等服務(wù)建站,正寧等地企業(yè),進行企業(yè)商務(wù)咨詢服務(wù)。為正寧企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

在開發(fā)過程中,當(dāng)我們的需求中包含說說或者評論等內(nèi)容的展示時,我們都會考慮當(dāng)內(nèi)容太多時該如何顯示。當(dāng)內(nèi)容的字?jǐn)?shù)太多,如果全部展示出來可能會影響體驗效果,但是又不能只截取一部分內(nèi)容進行展示,此時就需要考慮使用多行顯示折疊的效果來實現(xiàn)。

效果圖:

使用

1.布局文件調(diào)用

<LinearLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical">

 <com.wiggins.expandable.widget.MoreLineTextView
  android:id="@+id/tv_more_line_short"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@color/white"
  android:padding="@dimen/padding_small"
  app:clickAll="true"
  app:textColor="@color/red" />

 <View  />

 <com.wiggins.expandable.widget.expandable.ExpandableTextView
  android:id="@+id/tv_expandable_short"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@color/white"
  android:ellipsize="end"
  android:padding="@dimen/padding_small"
  android:textColor="@color/blue"
  app:allClickable="false"
  app:contentTextColor="@color/blue"
  app:isDisplayIcon="false"
  app:maxCollapsedLines="4" />

 <View  />

 <com.wiggins.expandable.widget.MoreLineTextView
  android:id="@+id/tv_more_line_long"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@color/white"
  android:padding="@dimen/padding_small"
  app:clickAll="true"
  app:textColor="@color/red" />

 <View  />

 <com.wiggins.expandable.widget.expandable.ExpandableTextView
  android:id="@+id/tv_expandable_long"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@color/white"
  android:ellipsize="end"
  android:padding="@dimen/padding_small"
  android:textColor="@color/blue"
  app:allClickable="false"
  app:contentTextColor="@color/blue"
  app:isDisplayIcon="false"
  app:maxCollapsedLines="4" />
</LinearLayout>

本文標(biāo)題:AndroidTextView實現(xiàn)多文本折疊、展開效果-創(chuàng)新互聯(lián)
本文來源:http://bm7419.com/article38/cdiopp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、網(wǎng)站排名響應(yīng)式網(wǎng)站、網(wǎng)站收錄、App開發(fā)企業(yè)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)