[英]How to display fully visible Items in top of the Listview after scrolling?
how to proceed forward in the listview
. 如何在listview
前进。 i am having listitem
consists of 30 items which displaying only images
. 我有listitem
包含30个仅显示images
项目。
In visible screen we can able to see minimum 1 1/2 images per screen(ie., one full image and half of the second Image).. When I scrolling the listview
, many times it happen top item in the listview
is partially visible(ie, only half can be seen). 在可见屏幕中,我们每屏至少可以看到1 1/2张图像(即,一张完整图像和第二张图像的一半)。当我滚动listview
,它多次发生在listview
顶部项目是部分可见的(即只能看到一半)。 So i want restrict that in the listview
...After Scrolling i want display only fully visible items in top of the Listview
, avoiding partially visible items in top of the listview
. 所以我想限制它在listview
...滚动之后,我只希望在listview
顶部仅显示完全可见的Listview
,避免在listview
顶部显示部分可见的项目。
Can anyone help me. 谁能帮我。 Please suggest any ides to solve this issues. 请提出解决此问题的建议。
mListView.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
mListView.smoothScrollToPosition(mListView.getFirstVisiblePosition());
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
Finally i am got it based on setSelection() method. 最终我基于setSelection()方法得到了它。
mainListView.setOnScrollListener(new OnScrollListener() {
//int currentTopVisible;
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
int index=mainListView.getFirstVisiblePosition();
mainListView.setSelection(index);
} } }}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.