本文整理汇总了Java中com.nhaarman.listviewanimations.util.AdapterViewUtil.getViewForPosition方法的典型用法代码示例。如果您正苦于以下问题:Java AdapterViewUtil.getViewForPosition方法的具体用法?Java AdapterViewUtil.getViewForPosition怎么用?Java AdapterViewUtil.getViewForPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.nhaarman.listviewanimations.util.AdapterViewUtil
的用法示例。
在下文中一共展示了AdapterViewUtil.getViewForPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fling
import com.nhaarman.listviewanimations.util.AdapterViewUtil; //导入方法依赖的package包/类
/**
* Flings the {@link android.view.View} corresponding to given position out of sight.
* Calling this method has the same effect as manually swiping an item off the screen.
*
* @param position the position of the item in the {@link android.widget.ListAdapter}. Must be visible.
*/
public void fling(final int position) {
int firstVisiblePosition = mListViewWrapper.getFirstVisiblePosition();
int lastVisiblePosition = mListViewWrapper.getLastVisiblePosition();
if (position < firstVisiblePosition || position > lastVisiblePosition) {
throw new IllegalArgumentException("View for position " + position + " not visible!");
}
View downView = AdapterViewUtil.getViewForPosition(mListViewWrapper, position);
if (downView == null) {
throw new IllegalStateException("No view found for position " + position);
}
flingView(downView, position, true);
mActiveSwipeCount++;
mVirtualListCount--;
}
示例2: dismissAbove
import com.nhaarman.listviewanimations.util.AdapterViewUtil; //导入方法依赖的package包/类
private void dismissAbove(final int position) {
View view = AdapterViewUtil.getViewForPosition(getListViewWrapper(), getListViewWrapper().getFirstVisiblePosition());
if (view != null) {
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
int scrollDistance = view.getMeasuredHeight();
getListViewWrapper().smoothScrollBy(scrollDistance, (int) mDismissAnimationTime);
mHandler.postDelayed(new RestoreScrollRunnable(scrollDistance, position), mDismissAnimationTime);
}
}