本文整理了Java中android.widget.ListView.smoothScrollBy()
方法的一些代码示例,展示了ListView.smoothScrollBy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListView.smoothScrollBy()
方法的具体详情如下:
包路径:android.widget.ListView
类名称:ListView
方法名:smoothScrollBy
暂无
代码示例来源:origin: TommyLemon/APIJSON
/**显示列表内容
* @author author
* @param list
*/
private void setList(List<String> list) {
if (hasList == false || list == null || list.size() <= 0) {
Log.i(TAG, "setList list == null || list.size() <= 0 >> adapter = null;lvEditTextInfo.setAdapter(null); return;");
adapter = null;
lvEditTextInfo.setAdapter(null);
return;
}
adapter = new ArrayAdapter<String>(context, R.layout.list_item, R.id.tvListItem, list);
lvEditTextInfo.setAdapter(adapter);
// if (hasUrl) {
// }
lvEditTextInfo.smoothScrollBy(60, 200);
}
代码示例来源:origin: TommyLemon/Android-ZBLibrary
/**显示列表内容
* @author author
* @param list
*/
private void setList(List<String> list) {
if (hasList == false || list == null || list.size() <= 0) {
Log.i(TAG, "setList list == null || list.size() <= 0 >> adapter = null;lvEditTextInfo.setAdapter(null); return;");
adapter = null;
lvEditTextInfo.setAdapter(null);
return;
}
adapter = new ArrayAdapter<String>(context, R.layout.list_item, R.id.tvListItem, list);
lvEditTextInfo.setAdapter(adapter);
// if (hasUrl) {
// }
lvEditTextInfo.smoothScrollBy(60, 200);
}
代码示例来源:origin: stackoverflow.com
final ListView listView = ...;
View listItemView = ...;
listView.smoothScrollBy(listItemView.getHeight() * NUMBER_OF_VIEWS,
DURATION * 2);
listView.postDelayed(new Runnable() {
public void run() {
listView.smoothScrollBy(0, 0); // Stops the listview from overshooting.
listView.setSelection(0);
}
}, DURATION);
代码示例来源:origin: robolectric/robolectric
@Test
public void smoothScrollBy_shouldBeRecorded() throws Exception {
listView.smoothScrollBy(42, 420);
assertThat(shadowOf(listView).getLastSmoothScrollByDistance()).isEqualTo(42);
assertThat(shadowOf(listView).getLastSmoothScrollByDuration()).isEqualTo(420);
}
代码示例来源:origin: 1993hzw/QZoneComment
/**
* @see CommentDialogListener
* @param inputViewCoordinatesInScreen [left,top]
*/
@Override
public void onShow(int[] inputViewCoordinatesInScreen) {
if (listView != null) {
// 点击某条评论则这条评论刚好在输入框上面,点击评论按钮则输入框刚好挡住按钮
int span = btnComment.getId() == R.id.btn_input_comment ? 0 : btnComment.getHeight();
listView.smoothScrollBy(coord[1] + span - inputViewCoordinatesInScreen[1], 1000);
}
}
代码示例来源:origin: mtotschnig/MyExpenses
@Override
protected void pageScrollDown() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
final int height = mListView.getHeight();
mListView.smoothScrollBy(height, 500);
}
}
代码示例来源:origin: stackoverflow.com
final ListView listView = getListView();
listView.setSelection(firstVisibleItem);
listView.smoothScrollBy(-firstVisibleItemTop, 0);
代码示例来源:origin: stackoverflow.com
private void pageScroll(ListView l) {
l.smoothScrollBy(l.getHeight(), 300);
}
代码示例来源:origin: derry/delion
@Override
public void onTimeUpdate(TimeAnimator animation, long totalTime, long deltaTime) {
ListPopupWindow popup = mAppMenu.getPopup();
if (popup == null || popup.getListView() == null) return;
// We keep both mDragScrollOffset and mDragScrollOffsetRounded because
// the actual scrolling is by the rounded value but at the same time we also
// want to keep the precise scroll value in float.
mDragScrollOffset += (deltaTime * 0.001f) * mDragScrollingVelocity;
int diff = Math.round(mDragScrollOffset - mDragScrollOffsetRounded);
mDragScrollOffsetRounded += diff;
popup.getListView().smoothScrollBy(diff, 0);
// Force touch move event to highlight items correctly for the scrolled position.
if (!Float.isNaN(mLastTouchX) && !Float.isNaN(mLastTouchY)) {
menuItemAction(Math.round(mLastTouchX), Math.round(mLastTouchY),
ITEM_ACTION_HIGHLIGHT);
}
}
});
代码示例来源:origin: Calsign/APDE
@Override
public boolean onDrag(View view, DragEvent event) {
// If the dragged item is nearing the edges, scroll to see more content
// Dragged items will be sketches / folders
switch(event.getAction()) {
case DragEvent.ACTION_DRAG_LOCATION:
float y = event.getY();
float h = drawerList.getHeight();
float upDif = y - THRESHOLD;
float downDif = y - (h - THRESHOLD);
if(upDif < 0) {
drawerList.smoothScrollBy((int) upDif, 300);
}
if(downDif > 0) {
drawerList.smoothScrollBy((int) upDif, 300);
}
break;
}
return true;
}
});
内容来源于网络,如有侵权,请联系作者删除!