Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
recyclerview get view location
package com.example.ted.parallellistview;
import android.view.View;
import de.greenrobot.event.EventBus;
* Created by tedliang on 14/12/16.
public class MyItemDecoration extends RecyclerView.ItemDecoration{
public void onDraw(Canvas c, RecyclerView parent) {
final int childCount = parent.getChildCount();
for (int i = 0; i < childCount; i++) {
final View child = parent.getChildAt(i);
if (parent.getChildPosition(child) % 10 == 0) {
EventBus.getDefault().post(new MyImageView.ChangeYEvent(child.getBottom()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment