Listview高级标签使用transcriptMode,stackFromBottom
2015-12-24 14:09
706 查看
在Listview中使用一些高级标签来满足一些特殊的需求。
Must be one of the following constant values.
这个是官方API文档的描述,android:transcriptMode本人的理解就是用来设置Listview自动滚动到底部的类型。
- disabled就是默认,不会自动滚动到底部
- normal 当键盘弹出时会自动滚动到底部,调用notifyDataSetChanged是不会自动滚动的。(这个适合聊天页面使用)
- alwaysScroll默认滚动到底部,键盘弹出和调用notifyDataSetChanged都会自动滚动到底部
Must be a boolean value, either “true” or “false”.
This may also be a reference to a resource (in the form “@[package:]type:name”) or theme attribute (in the form “?[package:][type:]name”) containing a value of this type.
This corresponds to the global attribute resource symbol stackFromBottom.
这个参数有两个选择,
-“false”:默认选择,Listview将从顶部开始填充
-“true”:从底部开始填充
android:transcriptMode
Sets the transcript mode for the list. In transcript mode, the list scrolls to the bottom to make new items visible when they are added.Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
disabled | 0 | Disables transcript mode. This is the default value. |
normal | 1 | The list will automatically scroll to the bottom when a data set change notification is received and only if the last item is already visible on screen. |
alwaysScroll | 2 | The list will automatically scroll to the bottom, no matter what items are currently visible. |
- disabled就是默认,不会自动滚动到底部
- normal 当键盘弹出时会自动滚动到底部,调用notifyDataSetChanged是不会自动滚动的。(这个适合聊天页面使用)
- alwaysScroll默认滚动到底部,键盘弹出和调用notifyDataSetChanged都会自动滚动到底部
android:stackFromBottom
Used by ListView and GridView to stack their content from the bottom.Must be a boolean value, either “true” or “false”.
This may also be a reference to a resource (in the form “@[package:]type:name”) or theme attribute (in the form “?[package:][type:]name”) containing a value of this type.
This corresponds to the global attribute resource symbol stackFromBottom.
这个参数有两个选择,
-“false”:默认选择,Listview将从顶部开始填充
-“true”:从底部开始填充
相关文章推荐
- 使用C++实现JNI接口需要注意的事项
- Android IPC进程间通讯机制
- Android Manifest 用法
- [转载]Activity中ConfigChanges属性的用法
- Android之获取手机上的图片和视频缩略图thumbnails
- Android之使用Http协议实现文件上传功能
- Android学习笔记(二九):嵌入浏览器
- android string.xml文件中的整型和string型代替
- i-jetty环境搭配与编译
- android之定时器AlarmManager
- android wifi 无线调试
- Android Native 绘图方法
- Android java 与 javascript互访(相互调用)的方法例子
- android 代码实现控件之间的间距
- android FragmentPagerAdapter的“标准”配置
- Android"解决"onTouch和onClick的冲突问题
- android:installLocation简析
- android searchView的关闭事件
- SourceProvider.getJniDirectories