2016-03-07 68 views
0

我有一個TextView,一次顯示7行。我試圖在TextView下面放置一個圖標,這樣如果我點擊該圖標,如果有更多的線條,則會出現接下來的7行。Android:Textview顯示特定行數並點擊按鈕查看下一行數

<TextView 
     android:id="@+id/tvDesc" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:maxLines="7" 
     android:scrollbars="vertical" 
     android:paddingTop="3dp" 
     android:paddingLeft="7dp" 
     android:paddingRight="7dp" 
     android:layout_alignTop="@+id/curl" 
     android:layout_alignLeft="@+id/curl" 
     android:textSize="16dp" 
     android:text="" 
     android:fadeScrollbars="false" 
     android:textColor="#000000" /> 

<ImageView 
     android:id="@+id/iv_scrollD" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="0dp" 
     android:layout_below="@+id/tvmsg" 
     android:layout_alignParentLeft="true" 
     android:src="@drawable/plus_24" /> 

有人可以幫忙嗎?

回答

0

您正在實施類似於經常使用的「顯示更多」選項的內容。這個確切的問題回答了here

使用SpannableStringBuilder顯示「顯示更多」和「顯示更少」的字符串(的TextView下的文字,你在說什麼。請參考答案更多的細節。