Created
December 16, 2014 14:54
-
-
Save nightbear1009/db88e9eefa3e16549626 to your computer and use it in GitHub Desktop.
recyclerview get view location
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.ted.parallellistview; | |
import android.graphics.Canvas; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.View; | |
import de.greenrobot.event.EventBus; | |
/** | |
* Created by tedliang on 14/12/16. | |
*/ | |
public class MyItemDecoration extends RecyclerView.ItemDecoration{ | |
@Override | |
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