Skip to content

Instantly share code, notes, and snippets.

View rafaelkowal's full-sized avatar

Rafael Kowal rafaelkowal

View GitHub Profile
public class GridAndListLayout extends TWAbsLayoutManager {
private final int NUM_LANES = 2;
public GridAndListLayout(Context context, Orientation orientation) {
super(context, orientation);
}
private boolean isVertical() {
return (getOrientation() == Orientation.VERTICAL);
}
@grantland
grantland / post.md
Last active February 9, 2023 05:09
RecyclerView item onClick

RecyclerView item onClick

RecyclerView does not have an OnItemClickListener like it's predecessor, ListView. However, detecting item clicks is pretty simple.

Set an OnClickListener in your ViewHolder creation:

private class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder>  {

    public static class ViewHolder extends RecyclerView.ViewHolder