介绍
ExpandableTextView 是一个Android库,使开发人员能够轻松地创建一个TextView可以展开/折叠就像谷歌Play的应用说明。随意使用它所有你想在你的Android应用程序,只要你引用这个项目。控件一般用在应用详情页面的简介中,可伸缩扩展的。
展示图
依赖
GitHub源码 点击查看
dependencies {
compile 'com.ms-square:expandableTextView:0.1.4'
}
)
使用这种库其实是很简单的,只要看看提供的源代码示例。(看在一个ListView的使用sampletextlistadapter.java)
注意:查看id TextView和ImageButton必须设置为“@ id / expandable_text”和“@ id / expand_collapse”提供给这个库使用,固定的。
另外,你可以设置你的XML布局文件中的下列属性来定制的expandabletextview行为。
1、maxcollapsedlines(默认为8)文本行可以显示当TextView行数最大数量
2、animduration(默认为300ms)为展开/折叠的动画时间
3、animalphastart(默认为0.7f)透明度值的TextView当动画开始(注)如果您想禁用α动画设置这个值为1
4、expanddrawable自定义图像设置为ImageButton展开方法
5、collapsedrawable自定义图像设置为ImageButton关闭的方法
栗子1:
<com.ms.square.android.expandabletextview.ExpandableTextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
android:id=