本文整理汇总了C#中RecyclerView.GetChildPosition方法的典型用法代码示例。如果您正苦于以下问题:C# RecyclerView.GetChildPosition方法的具体用法?C# RecyclerView.GetChildPosition怎么用?C# RecyclerView.GetChildPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecyclerView
的用法示例。
在下文中一共展示了RecyclerView.GetChildPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnInterceptTouchEvent
public bool OnInterceptTouchEvent(RecyclerView rv, MotionEvent e)
{
View child = rv.FindChildViewUnder(e.GetX(), e.GetY());
if (child != null && clickListener != null && gestureDetector.OnTouchEvent(e))
{
clickListener.OnClick(child, rv.GetChildPosition(child));
}
return false;
}
示例2: RecyclerTouchListener
public RecyclerTouchListener(Context context, RecyclerView recyclerView, IOnClickListener clickListener)
{
this.clickListener = clickListener;
var gestureListener = new GenericOnGestureListener();
gestureListener.ActionOnLongPress = (e) =>
{
View child = recyclerView.FindChildViewUnder(e.GetX(), e.GetY());
if (child != null && clickListener != null)
{
clickListener.OnLongClick(child, recyclerView.GetChildPosition(child));
}
};
gestureListener.FuncOnSingleTapUp = (e) => true;
gestureDetector = new GestureDetector(context, gestureListener);
}
示例3: GetItemOffsets
public override void GetItemOffsets (Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
{
base.GetItemOffsets (outRect, view, parent, state);
if (mDivider == null) {
return;
}
if (parent.GetChildPosition (view) < 1) {
return;
}
if (GetOrientation (parent) == LinearLayoutManager.Vertical) {
outRect.Top = mDivider.IntrinsicHeight;
} else {
outRect.Left = mDivider.IntrinsicWidth;
}
}
示例4: OnScrolled
public override void OnScrolled(RecyclerView recyclerView, int dx, int dy)
{
View firstVisibleView = recyclerView.GetChildAt(0);
int firstVisiblePosition = recyclerView.GetChildPosition(firstVisibleView);
int visibleRange = recyclerView.ChildCount;
int lastVisiblePosition = firstVisiblePosition + visibleRange;
int itemCount = recyclerView.GetAdapter().ItemCount;
int position;
if(firstVisiblePosition==0)
position=0;
else if(lastVisiblePosition==itemCount-1)
position = itemCount-1;
else
position = firstVisiblePosition;
float proportion=(float)position/(float)itemCount;
this.scroll.setPosition(scroll.height*proportion);
}