【开源】ExpandableTextView
ExpandableTextView
- https://github.com/Manabu-GT/ExpandableTextView
介绍:
ExpandableTextView 是一个让你轻松实现“展开收起(expand/collapse)”功能的控件 ,运行效果:
![]()
使用说明:
ExpandableTextView最为一个容器,包含了文字显示部分TextView 以及触发展开收起的按钮(那个小箭头)ImageButton
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
<!-- sample xml --><com.ms.square.android.expandabletextview.ExpandableTextView android:id="@+id/expand_text_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" expandableTextView:maxCollapsedLines="4" expandableTextView:animDuration="200"> <TextView android:id="@id/expandable_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:textSize="16sp" android:textColor="#666666" /> <ImageButton android:id="@id/expand_collapse" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="16dp" android:layout_gravity="right|bottom" android:background="@android:color/transparent"/></com.ms.square.android.expandabletextview.ExpandableTextView> |
下面是ExpandableTextView的一些属性:
-
maxCollapsedLines(默认为8) 当TextView 收起的时候允许显示的最大行数。 -
animDuration(默认300ms)展开收起动画的持续时间 -
animAlphaStart(默认 0.7f)在展开收起动画的时候TextView 的透明度。如果不想要透明度可以设置为1. -
expandDrawableCustomize 展开按钮的Drawable -
collapseDrawableCustomize 收起按钮的Drawable -
posted on 2015-04-02 11:02 wasdchenhao 阅读(372) 评论(0) 收藏 举报

浙公网安备 33010602011771号