【发布时间】:2017-01-08 12:01:31
【问题描述】:
我正在开发一个聊天应用程序,当列表加载和新项目添加到列表时,我需要滚动到列表底部。我可以这样做。
scrollToBottom() {
let lv = <ListView>frame.topmost().getViewById('messageList');
lv.scrollToIndex(this.store.items.getValue().length - 1)
}
但它立即显示列表底部
有一个指南可以在 IOS 上执行此操作,但在 Android 上没有
private srollListView(position: number) {
if (this._listView.ios) {
this._listView.ios.scrollToRowAtIndexPathAtScrollPositionAnimated(
NSIndexPath.indexPathForItemInSection(position, 0),
UITableViewScrollPosition.UITableViewScrollPositionTop,
true
);
}
else {
this._listView.scrollToIndex(position);
}
}
指南链接:http://nuvious.com/Blog/2016/4/4/how-to-make-the-nativescript-listview-scrolltoindex-animated-on-ios
有没有办法在 Android 上做到这一点?
【问题讨论】:
-
在此处参考类似问题:stackoverflow.com/a/38305534/6449750
标签: nativescript angular2-nativescript