因为公司需要,才去研究这个
最终效果:
1、点击任何一个item的评论按钮,出现评论框,弹出输入法,这个item恰好在输入法上边
实现思路:
主要是设置listview中item的位置,其实 ,设置它的位置,主要有两个访求:
listView.setSelection(int position) 设置某个item滚动到当前的顶部
listView.setSelectionFromTop(int position,int top) 设置某个item滚动到距离当前页面,但不是顶部,而是距离顶部的某个位置,距离为top参数
还有一个listView.getBottom,返回这个listview的底部的x坐标,其实 ,这样就可以了:
viewHeight为listview中每个item的高度,
listview.getBottom为这个listview的高度,
position为当前点击的item在listview中的位置,
这样的话,捕获点击事件,在点击事件里设置listview.setSelectionFromTop(position,listview.getBottom-viewheight),就可以让这个item移到屏幕底部。
其实 ,在实际使用过程中,因为每次使用过程中,都会弹出输入法,所以,之前listview.getBottom